-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Changes to support related entries grid: Refactor next and prev buttons. Add PlayerArea for playback controls. Export components for use by related plugin. Fixes FEC-11738.
- Loading branch information
1 parent
e491c28
commit 6a18a35
Showing
8 changed files
with
111 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export {PlaylistButton} from './playlist-button'; | ||
export {PrevNext} from './prev-next'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* eslint-disable require-jsdoc */ | ||
//@flow | ||
import style from '../../styles/style.scss'; | ||
import {h, Component, Fragment} from 'preact'; | ||
import {withText} from 'preact-i18n'; | ||
import {Button} from 'components/button'; | ||
import {Tooltip} from 'components/tooltip'; | ||
import {default as Icon, IconType} from '../icon'; | ||
|
||
@withText({ | ||
prevControlsText: 'controls.prev', | ||
nextControlsText: 'controls.next', | ||
playlistPrevText: 'playlist.prev', | ||
playlistUpNextText: 'playlist.up_next' | ||
}) | ||
class PrevNext extends Component { | ||
render(props: any): React$Element<any> { | ||
const {type, item, onClick} = props; | ||
|
||
const iconType = type === 'next' ? IconType.Next : IconType.Prev; | ||
const tooltipText = props[`${props.type}ControlsText`]; | ||
const previewTitle = type === 'prev' ? this.props.playlistPrevText : this.props.playlistUpNextText; | ||
|
||
const previewImage = item?.sources?.poster; | ||
const previewText = item.sources?.metadata ? item.sources.metadata.name : ''; | ||
|
||
const button = ( | ||
<Button disabled={!item} tabIndex="0" aria-label={tooltipText} className={`${style.controlButton}`} onClick={onClick}> | ||
<div> | ||
<Icon type={iconType} /> | ||
</div> | ||
</Button> | ||
); | ||
|
||
return ( | ||
<div className={[style.controlButtonContainer, style.controlPlaylistButton].join(' ')}> | ||
{previewImage || previewText ? ( | ||
<Fragment> | ||
<div className={style.posterPreview}> | ||
<div className={style.posterPreviewText}> | ||
<div className={style.posterPreviewTextTitle}>{previewTitle}</div> | ||
<div className={style.posterPreviewTextName}>{`${previewText ? previewText : ''}`}</div> | ||
</div> | ||
{previewImage ? <div className={style.posterPreviewImg} style={`background-image: url(${previewImage});`} /> : undefined} | ||
</div> | ||
{button} | ||
</Fragment> | ||
) : ( | ||
<Tooltip label={tooltipText}>{button}</Tooltip> | ||
)} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export {PrevNext}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters