mirror of
https://github.com/vercel/commerce.git
synced 2025-07-30 05:31:22 +00:00
.vscode
packages
site
assets
components
auth
cart
checkout
common
icons
product
ui
Button
Collapse
Container
Grid
Grid.module.css
Grid.tsx
index.ts
Hero
Input
Link
LoadingDots
Logo
Marquee
Modal
Quantity
Rating
Sidebar
Skeleton
Text
README.md
context.tsx
index.ts
wishlist
search.tsx
config
lib
pages
public
.env.template
.eslintrc
.gitignore
.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
turbo.json
yarn.lock
35 lines
797 B
TypeScript
35 lines
797 B
TypeScript
import cn from 'clsx'
|
|
import { FC, ReactNode, Component } from 'react'
|
|
import s from './Grid.module.css'
|
|
|
|
interface GridProps {
|
|
className?: string
|
|
children?: ReactNode[] | Component[] | any[]
|
|
layout?: 'A' | 'B' | 'C' | 'D' | 'normal'
|
|
variant?: 'default' | 'filled'
|
|
}
|
|
|
|
const Grid: FC<GridProps> = ({
|
|
className,
|
|
layout = 'A',
|
|
children,
|
|
variant = 'default',
|
|
}) => {
|
|
const rootClassName = cn(
|
|
s.root,
|
|
{
|
|
[s.layoutA]: layout === 'A',
|
|
[s.layoutB]: layout === 'B',
|
|
[s.layoutC]: layout === 'C',
|
|
[s.layoutD]: layout === 'D',
|
|
[s.layoutNormal]: layout === 'normal',
|
|
[s.default]: variant === 'default',
|
|
[s.filled]: variant === 'filled',
|
|
},
|
|
className
|
|
)
|
|
return <div className={rootClassName}>{children}</div>
|
|
}
|
|
|
|
export default Grid
|