Add video overlay header.

This commit is contained in:
Daniel Dominguez 2018-05-31 19:46:45 -03:00
parent 92cd06bc52
commit 0771cd2af1
6 changed files with 68 additions and 22 deletions

View file

@ -1,9 +1,14 @@
import { connect } from 'react-redux';
import { selectPlayingUri } from 'redux/selectors/content';
import { doSetPlayingUri } from 'redux/actions/content';
import VideoOverlay from './view';
const select = state => ({
playingUri: selectPlayingUri(state),
});
export default connect(select, null)(VideoOverlay);
const perform = dispatch => ({
cancelPlay: () => dispatch(doSetPlayingUri(null)),
});
export default connect(select, perform)(VideoOverlay);

View file

@ -1,22 +1,22 @@
// @flow
import React from 'react';
import Video from 'component/video';
import FileActions from 'component/fileActions';
import Overlay from 'component/overlay';
import VideoOverlayHeader from '../videoOverlayHeader';
type Props = {
cancelPlay: () => void,
playingUri: ?string,
};
class VideoOverlay extends React.Component<Props> {
render() {
const { playingUri } = this.props;
const { playingUri, cancelPlay } = this.props;
if (!playingUri) return '';
return (
<Overlay>
<div className="card-media__internal-links">
<FileActions uri={playingUri} vertical />
</div>
{playingUri ? <Video className="content__embedded" uri={playingUri} overlayed /> : ''}
<VideoOverlayHeader uri={playingUri} onClose={cancelPlay} />
<Video className="content__embedded" uri={playingUri} overlayed />
</Overlay>
);
}

View file

@ -0,0 +1,10 @@
import { connect } from 'react-redux';
import { makeSelectTitleForUri } from 'lbry-redux';
import VideoOverlayHeader from './view';
const select = (state, props) => ({
title: makeSelectTitleForUri(props.uri)(state),
onClose: props.onClose,
});
export default connect(select, null)(VideoOverlayHeader);

View file

@ -0,0 +1,31 @@
// @flow
import React from 'react';
import Button from 'component/button';
import * as icons from 'constants/icons';
import TruncatedText from 'component/common/truncated-text';
type Props = {
onClose: () => void,
title: string,
};
class VideoOverlayHeader extends React.Component<Props> {
render() {
const { onClose, title } = this.props;
return (
<header className="video_overlay__header">
<h4 className="overlay__title--small">
<TruncatedText lines={2}>{title}</TruncatedText>
</h4>
<Button
icon={icons.CLOSE}
onClick={() => {
onClose();
}}
/>
</header>
);
}
}
export default VideoOverlayHeader;

View file

@ -8,21 +8,21 @@
right: 1%;
z-index: 3;
box-shadow: var(--box-shadow-layer);
}
&:hover .button-close {
display: inline-block;
background: rgba(0, 0, 0, 0.5);
position: absolute;
height: 22px;
width: 22px;
top: 0px;
right: 0px;
color: #000;
text-align: center;
cursor: pointer;
z-index: 4;
.video_overlay__header {
flex-direction: row;
justify-content: space-between;
align-items: center;
flex-wrap: nowrap;
display: flex;
width: 100%;
height: 2rem;
background-color: var(--header-primary-color);
padding: 20px 10px;
.overlay__title--small {
font-size: 15px;
line-height: 15px;
}
}
.overlay .button-close {
display: none;
}