forked from crowetic/commerce
assets
components
cart
core
icon
product
ui
Button
Container
Grid
Grid.module.css
Grid.tsx
index.ts
Hero
Link
LoadingDots
Logo
Marquee
Modal
Sidebar
Skeleton
README.md
context.tsx
index.ts
types.ts
wishlist
config
lib
pages
public
utils
.gitignore
.prettierignore
README.md
codegen.json
global.d.ts
next-env.d.ts
next.config.js
package.json
postcss.config.js
tailwind.config.js
tsconfig.json
yarn.lock
35 lines
795 B
TypeScript
35 lines
795 B
TypeScript
import cn from 'classnames'
|
|
import { FC, ReactNode, Component } from 'react'
|
|
import s from './Grid.module.css'
|
|
|
|
interface Props {
|
|
className?: string
|
|
children?: ReactNode[] | Component[] | any[]
|
|
layout?: 'A' | 'B' | 'C' | 'D' | 'normal'
|
|
variant?: 'default' | 'filled'
|
|
}
|
|
|
|
const Grid: FC<Props> = ({
|
|
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
|