diff --git a/src/components/SourceOverlay.jsx b/src/components/SourceOverlay.jsx index 2999bfe..e5a79f6 100644 --- a/src/components/SourceOverlay.jsx +++ b/src/components/SourceOverlay.jsx @@ -4,148 +4,118 @@ import { Player } from 'video-react' import Spinner from './presentational/Spinner' import NoSource from './presentational/NoSource' -class SourceOverlay extends React.Component { - constructor(props) { - super(props) - this.renderVideo = this.renderVideo.bind(this) - this.renderPhoto = this.renderPhoto.bind(this) - this.renderPhotobook = this.renderPhotobook.bind(this) - this.renderTestimony = this.renderTestimony.bind(this) +function SourceOverlay ({ source, onCancel }) { + function renderImage(path) { + return ( +
+ } + unloader={} + /> +
+ ) } - renderVideo() { + function renderVideo(path) { // NB: assume only one video return (
) } - renderPhoto() { - return ( -
- } - unloader={} - /> -
- ) + function renderText(path) { + return (
{path}
) } - renderPhotobook() { - return ( -
- {this.props.source.paths.map((url, idx) => ( - } - unloader={} - /> + // renderImagebook() { + // return ( + //
+ // {source.paths.map((url, idx) => ( + // } + // unloader={} + // /> + // + // ))} + //
+ // ) + // } - ))} -
- ) - } - - renderError() { + function renderError() { return ( ) } - renderNoSupport(ext) { + function renderNoSupport(ext) { return ( - + ) } - renderTestimony() { - return ( -
- Download Testimony -
- ) - } - - _renderPath(path) { - // render conditionally based on the extension + function _renderPath(path) { switch (true) { case /\.(png|jpg)$/.test(path): - console.log('image') - return
{path}
+ return renderImage(path) case /\.(mp4)$/.test(path): - console.log('video') - return
{path}
+ return renderVideo(path) case /\.(md)$/.test(path): - console.log('text') - return
{path}
+ return renderText(path) default: console.log('unsupported extension') - return this.renderNoSupport(path.split('.')[1]) + return renderNoSupport(path.split('.')[1]) } } - _renderContent() { + function _renderContent() { return ( -
- {this.props.source.paths.map(this._renderPath)} -
+ + {source.paths.map(_renderPath)} + ) - // switch(this.props.source.type) { - // case 'Video': - // return this.renderVideo() - // case 'Photo': - // return this.renderPhoto() - // case 'Photobook': - // return this.renderPhotobook() - // case 'Eyewitness Testimony': - // return this.renderTestimony() - // default: - // return this.renderError() - // } } - render() { - if (typeof(this.props.source) !== 'object') { - return this.renderError() - } - const {id, url, title, date, type, affil_1, affil_2} = this.props.source - return ( -
-
-
-
- -
-
{this.props.source.id}
+ if (typeof(source) !== 'object') { + return renderError() + } + const {id, url, title, date, type, affil_1, affil_2} = source + return ( +
+
+
+
+
-
- {this._renderContent()} -
-
-
- {id ?
{id}
: null} - {title?
{title}
: null} -
- {type ?
Type: {type}
: null} - {date ?
Date:{date}
: null} -
- {url ? : null} -
+
{source.id}
+
+
+ {_renderContent()} +
+
+
+ {id ?
{id}
: null} + {title?
{title}
: null} +
+ {type ?
Type: {type}
: null} + {date ?
Date:{date}
: null} +
+ {url ? : null}
- ) - } +
+ ) } export default SourceOverlay diff --git a/src/components/presentational/CardSource.js b/src/components/presentational/CardSource.js index b3bca21..9b3da5b 100644 --- a/src/components/presentational/CardSource.js +++ b/src/components/presentational/CardSource.js @@ -43,7 +43,6 @@ const CardSource = ({ source, isLoading, onClickHandler }) => { const imgs = source.paths.filter(p => p.match(isImgUrl)) thumbnail = imgs.length > 0 ? imgs[0] : null } - console.log(thumbnail) const fallbackIcon = ( diff --git a/src/scss/mediaoverlay.scss b/src/scss/mediaoverlay.scss index 9046ba7..891280f 100644 --- a/src/scss/mediaoverlay.scss +++ b/src/scss/mediaoverlay.scss @@ -48,34 +48,45 @@ $header-inset: 10px; .mo-container { background-color: rgba(239, 239, 239, 0.9); - max-width: $panel-width; - min-width: $panel-width; - max-height: $panel-height; - min-height: $panel-height; + // max-width: $panel-width; + // min-width: $panel-width; + // max-height: $panel-height; + // min-height: $panel-height; display: flex; flex-direction: column; - justify-content: flex-start; align-items: center; + height: 80vh; + max-width: 90vw; .mo-media-container { flex: 1; display: flex; + flex-direction: column; justify-content: center; align-items: center; } } .mo-media-container { - // padding-top: 3*$header-inset; font-family: "Lato", Helvetica, sans-serif; - // max-height: $vimeo-height; min-width: 100%; - max-height: 500px; + max-height: 60vh; + overflow-y: auto; .media-player { width: 100%; max-width: $vimeo-width; } + + .media-content { + display: flex; + flex-direction: column; + } + + // NB: topcushion seems to be necessary with certain overflows.. + &.topcushion { + padding-top: 150px; + } } .mo-meta-container { @@ -146,8 +157,10 @@ $header-inset: 10px; .source-image-container { padding: 0 25px; - overflow-y: scroll; height: 100%; + display: flex; + justify-content: center; + align-items: center; } .source-image, .source-video {