mirror of
https://github.com/vercel/commerce.git
synced 2025-07-26 11:41:23 +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
AudioCardContent.tsx
ImageCardContent.tsx
VideoCardContent.tsx
ResourceCardModal
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
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
import { Box, Stack, Button, Text } from "@chakra-ui/react";
|
|
import { createRef } from "react";
|
|
import H5AudioPlayer from "react-h5-audio-player";
|
|
|
|
export default function AudioCardContent(props: {
|
|
style: any
|
|
resourcePath: string,
|
|
resourceCaption: string,
|
|
onPlay: (player: HTMLAudioElement) => void,
|
|
onPause: () => void,
|
|
onClose: () => void
|
|
}) {
|
|
|
|
const player = createRef<H5AudioPlayer>()
|
|
|
|
return (
|
|
<>
|
|
<Box
|
|
className={props.style.imageContainer}
|
|
w={'full'}
|
|
>
|
|
<H5AudioPlayer
|
|
src={props.resourcePath}
|
|
ref={player}
|
|
onCanPlay={e => props.onPlay(player.current?.audio.current!)}
|
|
/>
|
|
</Box>
|
|
|
|
<Box
|
|
p={5}
|
|
className={props.style.captionContainer}>
|
|
|
|
<Stack align={'center'}>
|
|
<Text padding={0} color={'gray.500'} fontSize={'sm'} align={'center'}>
|
|
{props.resourceCaption}
|
|
</Text>
|
|
<Button mt={5} onClick={(e) => {props.onClose();props.onPause();}} colorScheme='teal' variant='solid'>
|
|
BACKGROUND AUDIO
|
|
</Button>
|
|
</Stack>
|
|
</Box>
|
|
</>
|
|
)
|
|
}; |