mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
restoring modals for mobile image and video view
This commit is contained in:
parent
3b470680a5
commit
a04d6b9f4c
@ -12,12 +12,12 @@ export function ImageAsset({ thumbUrl, fullUrl }) {
|
|||||||
|
|
||||||
const popout = () => {
|
const popout = () => {
|
||||||
if (dimension.width / dimension.height > window.innerWidth / window.innerHeight) {
|
if (dimension.width / dimension.height > window.innerWidth / window.innerHeight) {
|
||||||
let width = Math.floor(window.innerWidth * 8 / 10);
|
let width = Math.floor(window.innerWidth * 9 / 10);
|
||||||
let height = Math.floor(width * dimension.height / dimension.width);
|
let height = Math.floor(width * dimension.height / dimension.width);
|
||||||
actions.setPopout(width, height);
|
actions.setPopout(width, height);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let height = Math.floor(window.innerHeight * 8 / 10);
|
let height = Math.floor(window.innerHeight * 9 / 10);
|
||||||
let width = Math.floor(height * dimension.width / dimension.height);
|
let width = Math.floor(height * dimension.width / dimension.height);
|
||||||
actions.setPopout(width, height);
|
actions.setPopout(width, height);
|
||||||
}
|
}
|
||||||
@ -38,23 +38,15 @@ export function ImageAsset({ thumbUrl, fullUrl }) {
|
|||||||
return <img style={{ height: '100%', objectFit: 'contain' }} src={thumbUrl} alt="" />
|
return <img style={{ height: '100%', objectFit: 'contain' }} src={thumbUrl} alt="" />
|
||||||
}}
|
}}
|
||||||
</ReactResizeDetector>
|
</ReactResizeDetector>
|
||||||
{ state.display !== 'small' && (
|
|
||||||
<div class="viewer">
|
<div class="viewer">
|
||||||
<div class="overlay" style={{ width: dimension.width, height: dimension.height }}
|
<div class="overlay" style={{ width: dimension.width, height: dimension.height }}
|
||||||
onClick={popout} />
|
onClick={popout} />
|
||||||
<Modal centered={true} visible={state.popout} width={state.width + 12} bodyStyle={{ width: '100%', height: 'auto', paddingBottom: 6, paddingTop: 6, paddingLeft: 6, paddingRight: 6, backgroundColor: '#dddddd' }} footer={null} destroyOnClose={true} closable={false} onCancel={actions.clearPopout}>
|
<Modal centered={true} visible={state.popout} width={state.width + 12} bodyStyle={{ width: '100%', height: 'auto', paddingBottom: 6, paddingTop: 6, paddingLeft: 6, paddingRight: 6, backgroundColor: '#dddddd' }} footer={null} destroyOnClose={true} closable={false} onCancel={actions.clearPopout}>
|
||||||
|
<div onClick={actions.clearPopout}>
|
||||||
<img style={{ width: '100%', objectFit: 'contain' }} src={fullUrl} alt="topic image" />
|
<img style={{ width: '100%', objectFit: 'contain' }} src={fullUrl} alt="topic image" />
|
||||||
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
{ state.display === 'small' && !state.popout && (
|
|
||||||
<div class="viewer" style={{ width: dimension.width, height: dimension.height }} onClick={popout} />
|
|
||||||
)}
|
|
||||||
{ state.display === 'small' && state.popout && (
|
|
||||||
<div class="fullscreen" onClick={clearPopout} onTouchEnd={clearPopout}>
|
|
||||||
<img class="image" src={fullUrl} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</ImageAssetWrapper>
|
</ImageAssetWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -40,14 +40,10 @@ export function VideoAsset({ thumbUrl, lqUrl, hdUrl }) {
|
|||||||
<VideoCameraOutlined style={{ fontSize: 32, color: '#eeeeee', cursor: 'pointer' }} />
|
<VideoCameraOutlined style={{ fontSize: 32, color: '#eeeeee', cursor: 'pointer' }} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{ state.active && state.display === 'small' && (
|
|
||||||
<video autoplay controls src={hdUrl} width={dimension.width} height={dimension.height} />
|
|
||||||
)}
|
|
||||||
{ state.display !== 'small' && (
|
|
||||||
<Modal centered={true} visible={state.active} width={state.width + 12} bodyStyle={{ paddingBottom: 0, paddingTop: 6, paddingLeft: 6, paddingRight: 6, backgroundColor: '#dddddd' }} footer={null} destroyOnClose={true} closable={false} onCancel={actions.clearActive}>
|
<Modal centered={true} visible={state.active} width={state.width + 12} bodyStyle={{ paddingBottom: 0, paddingTop: 6, paddingLeft: 6, paddingRight: 6, backgroundColor: '#dddddd' }} footer={null} destroyOnClose={true} closable={false} onCancel={actions.clearActive}>
|
||||||
<video autoplay={true} controls src={hdUrl} width={state.width} height={state.height} />
|
<video autoplay="true" controls src={hdUrl} width={state.width} height={state.height}
|
||||||
|
playsinline="true" />
|
||||||
</Modal>
|
</Modal>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</VideoAssetWrapper>
|
</VideoAssetWrapper>
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user