mirror of
https://github.com/vercel/commerce.git
synced 2025-07-28 04:31:22 +00:00
.github
.vscode
packages
site
assets
components
auth
cart
checkout
common
About
Avatar
Category
FeatureBar
Footer
Head
HomeAllProductsGrid
HomePage
I18nWidget
Layout
Navbar
News
Room
MarkerCardModal
ResourceCardContent
ResourceCardModal
ResourceCardModal.tsx
ResourceCardStyle.module.css
RoomTypes
SEO
Searchbar
SidebarLayout
UserNav
index.ts
icons
product
ui
wishlist
search.tsx
config
lib
pages
public
static_data
workers
.env.template
.eslintrc
.gitignore
.npmrc
.prettierignore
.prettierrc
commerce-config.js
commerce.config.json
global.d.ts
next-env.d.ts
next.config.js
package.json
postcss.config.js
tailwind.config.js
tsconfig.json
.editorconfig
.gitignore
.prettierignore
.prettierrc
README.md
license.md
package.json
pnpm-lock.yaml
pnpm-workspace.yaml
turbo.json
64 lines
2.1 KiB
TypeScript
64 lines
2.1 KiB
TypeScript
import { Box, Flex, propNames, Stack, Text } from "@chakra-ui/react"
|
|
import { MarkerResourcePayload } from "../RoomTypes/RoomTypes"
|
|
import { Image } from "@chakra-ui/react"
|
|
|
|
import 'react-h5-audio-player/lib/styles.css';
|
|
|
|
import style from './ResourceCardStyle.module.css';
|
|
import ImageCardContent from "../ResourceCardContent/ImageCardContent";
|
|
import AudioCardContent from "../ResourceCardContent/AudioCardContent";
|
|
import VideoCardContent from "../ResourceCardContent/VideoCardContent";
|
|
|
|
export default function ResourceCardModal(props: {
|
|
decade: string,
|
|
resourcePayload: MarkerResourcePayload,
|
|
onModalClose?: () => void,
|
|
onAudioPlay?: (player: HTMLAudioElement) => void,
|
|
onAudioPause?: () => void
|
|
}) {
|
|
|
|
const RES_PATH = '/regions/abruzzo/' + props.decade + '/resources/' + props.resourcePayload.resourceSource;
|
|
|
|
const getResourceContent = () => {
|
|
switch(props.resourcePayload.resourceType) {
|
|
case 'image':
|
|
return (
|
|
<ImageCardContent resourceCaption={props.resourcePayload.resourceCaption} resourcePath={RES_PATH} style={style} />
|
|
)
|
|
case 'audio':
|
|
return (
|
|
<AudioCardContent resourceCaption={props.resourcePayload.resourceCaption} style={style} resourcePath={RES_PATH} onPlay={props.onAudioPlay!} onPause={props.onAudioPause!} onClose={props.onModalClose!} />
|
|
)
|
|
case 'video':
|
|
return (
|
|
<VideoCardContent resourceCaption={props.resourcePayload.resourceCaption} style={style} resourcePath={RES_PATH} />
|
|
)
|
|
default:
|
|
return (<></>)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<Flex w="full" alignItems="center" justifyContent="center" direction={'row'}>
|
|
<Box
|
|
maxW={'445px'}
|
|
w={'full'}
|
|
boxShadow={'2xl'}
|
|
rounded={'md'}
|
|
overflow={'hidden'}
|
|
className={style.cardBody}>
|
|
|
|
<Image
|
|
className={style.decadeIcon}
|
|
src={'/assets/polygons/' + props.decade + '.svg'}
|
|
alt={`Picture of Decade`}
|
|
/>
|
|
|
|
{
|
|
getResourceContent()
|
|
}
|
|
|
|
</Box>
|
|
</Flex>
|
|
)
|
|
}; |