feat: add CardGrid and add style to StayCard
This commit is contained in:
32
components/TempDesignSystem/CardGrid/index.tsx
Normal file
32
components/TempDesignSystem/CardGrid/index.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import React, { PropsWithChildren } from "react"
|
||||
|
||||
import { CardGridProps } from "./cardGrid"
|
||||
import { cardGridVariants } from "./variants"
|
||||
|
||||
export default function CardGrid({
|
||||
children,
|
||||
isMobileCarousel = false,
|
||||
className,
|
||||
}: PropsWithChildren<CardGridProps>) {
|
||||
const amountOfChildren = React.Children.toArray(children).length
|
||||
|
||||
let variant: CardGridProps["variant"] = undefined
|
||||
|
||||
if (amountOfChildren % 3 === 0) {
|
||||
variant = "treeColumnGrid"
|
||||
} else if (amountOfChildren % 2 === 0) {
|
||||
variant = "twoColumnGrid"
|
||||
}
|
||||
|
||||
return (
|
||||
<section
|
||||
className={cardGridVariants({
|
||||
className,
|
||||
variant,
|
||||
isMobileCarousel,
|
||||
})}
|
||||
>
|
||||
{children}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user