Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 1x 1x 1x 1x 1x | /* eslint-disable jsx-a11y/click-events-have-key-events */ import React from 'react'; import { css } from '@emotion/react'; import { LayerType, Layer as LayerModal } from '@uniquegood/realworld-web-interface/lib/models/game/Layer'; import ARLayer from '@lib/components/Game/Layer/ARLayer'; import PhotoFrameLayer from '@lib/components/Game/Layer/PhotoFrameLayer'; const layerTypeToComponentMap: Record< LayerType, React.FC<{ layer: any; onSuccess: () => unknown; onClose: () => unknown }> > = { ar: ARLayer, photoFrame: PhotoFrameLayer }; export default function Layer({ layer, onSuccess, onClose }: { layer: LayerModal; onSuccess: () => unknown; onClose: () => unknown; }) { const { type } = layer; const LayerComponent = layerTypeToComponentMap[type]; return ( <div css={mainWrap}> <div css={mainRatioWrap}> <div css={mainRatioContainer}> <div css={mainContainer}> <LayerComponent layer={layer} onSuccess={onSuccess} onClose={onClose} /> </div> </div> </div> </div> ); } const mainWrap = css` width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; `; const mainRatioWrap = css` width: 100%; max-width: min(calc(100% - 10px), calc(calc(100vh - 52px) * 0.5625)); `; const mainRatioContainer = css` position: relative; padding-top: 160%; `; const mainContainer = css` position: absolute; inset: 0; border-radius: 8px; overflow: hidden; `; |