Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Walters committed Nov 23, 2020
1 parent 6feecc7 commit 7048da0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
70 changes: 35 additions & 35 deletions src/components/MediaOverlay/Media/Media.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
import PropTypes from 'prop-types';
import React, { Fragment } from 'react';
import React, { useContext } from 'react';
import MediaOverlayContext from '../MediaOverlay.context';
import DefaultAudio from './DefaultAudio/DefaultAudio';
import DefaultImage from './DefaultImage/DefaultImage';
import DefaultInteractive from './DefaultInteractive/DefaultInteractive';
import DefaultVideo from './DefaultVideo/DefaultVideo';
import './Media.module.scss';

const Media = () => (
<MediaOverlayContext.Consumer>
{({
overlayState: { assembly },
overlayProps: {
videoPlayerId,
generatePrerollUrl,
audioComponent: Audio = DefaultAudio,
imageComponent: Image = DefaultImage,
interactiveComponent: Interactive = DefaultInteractive,
videoComponent: Video = DefaultVideo,
},
hideSidebarAndControls,
overlayRef,
showSidebarAndControls,
}) => (
<>
{assembly.audio && <Audio filename={assembly.audio.filename} />}
{assembly.image && <Image {...assembly.image} lazyContainer={overlayRef.current} />}
{assembly.interactive && <Interactive {...assembly.interactive} />}
{assembly.video && (
<Video
assembly={assembly}
playerId={videoPlayerId}
onPlay={hideSidebarAndControls}
onPause={showSidebarAndControls}
onDisplayClick={hideSidebarAndControls}
generatePrerollUrl={generatePrerollUrl}
/>
)}
</>
)}
</MediaOverlayContext.Consumer>
);
const Media = () => {
const {
overlayState: { assembly },
overlayProps: {
videoPlayerId,
generatePrerollUrl,
audioComponent: Audio = DefaultAudio,
imageComponent: Image = DefaultImage,
interactiveComponent: Interactive = DefaultInteractive,
videoComponent: Video = DefaultVideo,
},
hideSidebarAndControls,
overlayRef,
showSidebarAndControls,
} = useContext(MediaOverlayContext);

return (
<>
{assembly.audio && <Audio filename={assembly.audio.filename} />}
{assembly.image && <Image {...assembly.image} lazyContainer={overlayRef.current} />}
{assembly.interactive && <Interactive {...assembly.interactive} />}
{assembly.video && (
<Video
assembly={assembly}
playerId={videoPlayerId}
onPlay={hideSidebarAndControls}
onPause={showSidebarAndControls}
onDisplayClick={hideSidebarAndControls}
generatePrerollUrl={generatePrerollUrl}
/>
)}
</>
);
};

Media.propTypes = {
assemblyId: PropTypes.number,
Expand Down
6 changes: 3 additions & 3 deletions src/components/MediaOverlay/MediaViewer/MediaViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const MediaViewer = () => {
onSwipeRight={navigatePreviousMedia}
className={classNames(styles.MediaViewer, { controlsHidden })}
>
{hasError ? <Fragment>{localeLabels.ERROR}</Fragment> : <Media />}
{hasError ? localeLabels.ERROR : <Media />}
{assemblies.length > 1 && !controlsHidden && (
<Fragment>
<>
{mediaIndex > 0 && (
<MediaLink
assemblyId={assemblies[mediaIndex - 1].assemblyId}
Expand All @@ -42,7 +42,7 @@ const MediaViewer = () => {
<FontAwesomeIcon icon={faAngleRight} size="3x" />
</MediaLink>
)}
</Fragment>
</>
)}
</Taparoo>
);
Expand Down

0 comments on commit 7048da0

Please sign in to comment.