1 import React from "react"
2 import { BadgeProps } from "@/components/Badge"
3 import { CardDefaultLayout } from "./Layout/Default"
4 import { IconProps } from "@medusajs/icons/dist/types"
5 import { CardLargeLayout } from "./Layout/Large"
6 import { CardFillerLayout } from "./Layout/Filler"
7 import { CardLayoutMini } from "./Layout/Mini"
8 import { LinkProps } from "next/link"
9 import { CardBloomLayout } from "./Layout/Bloom"
10
11 export type CardProps = {
12 type?: "default" | "large" | "filler" | "mini" | "bloom"
13 icon?: React.FC<IconProps>
14 rightIcon?: React.FC<IconProps>
15 image?: string
16 themeImage?: {
17 light: string
18 dark: string
19 }
20 imageDimensions?: {
21 width: number
22 height: number
23 }
24 title?: string
25 text?: string
26 href?: string
27 className?: string
28 contentClassName?: string
29 iconClassName?: string
30 children?: React.ReactNode
31 badge?: BadgeProps
32 highlightText?: string[]
33 closeable?: boolean
34 onClose?: () => void
35 onClick?: () => void
36 hrefProps?: Partial<LinkProps & React.AllHTMLAttributes<HTMLAnchorElement>>
37 cardRef?: React.Ref<HTMLDivElement>
38 }
39
40 export const Card = ({ type = "default", ...props }: CardProps) => {
41 switch (type) {
42 case "large":
43 return <CardLargeLayout {...props} />
44 case "filler":
45 return <CardFillerLayout {...props} />
46 case "mini":
47 return <CardLayoutMini {...props} />
48 case "bloom":
49 return <CardBloomLayout {...props} />
50 default:
51 return <CardDefaultLayout {...props} />
52 }
53 }