From 94448fa278ab352a741ff13f22d6104869571144 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 18 Oct 2023 19:25:02 +0200 Subject: feat(components): add a generic Grid component * merge Columns, Gallery and CardsList into Grid component * add more options to control the grid --- src/components/molecules/layout/columns.tsx | 62 ----------------------------- 1 file changed, 62 deletions(-) delete mode 100644 src/components/molecules/layout/columns.tsx (limited to 'src/components/molecules/layout/columns.tsx') diff --git a/src/components/molecules/layout/columns.tsx b/src/components/molecules/layout/columns.tsx deleted file mode 100644 index 56cd1a1..0000000 --- a/src/components/molecules/layout/columns.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import type { - FC, - HTMLAttributes, - ReactComponentElement, - ReactNode, -} from 'react'; -import styles from './columns.module.scss'; - -export type ColumnProps = HTMLAttributes & { - children: ReactNode; -}; - -/** - * Column component. - * - * Render the body as a column. - */ -export const Column: FC = ({ children, ...props }) => ( -
{children}
-); - -// eslint-disable-next-line @typescript-eslint/no-magic-numbers -type ColumnsNumber = 2 | 3 | 4; - -export type ColumnsProps = { - /** - * The columns. - */ - children: ReactComponentElement[]; - /** - * Set additional classnames to the columns wrapper. - */ - className?: string; - /** - * The number of columns. - */ - count: ColumnsNumber; - /** - * Should the columns be stacked on small devices? Default: true. - */ - responsive?: boolean; -}; - -/** - * Columns component. - * - * Render some Column components as columns. - */ -export const Columns: FC = ({ - children, - className = '', - count, - responsive = true, -}) => { - const countClass = `wrapper--${count}-columns`; - const responsiveClass = responsive - ? `wrapper--responsive` - : 'wrapper--no-responsive'; - const wrapperClass = `${styles.wrapper} ${styles[countClass]} ${styles[responsiveClass]} ${className}`; - - return
{children}
; -}; -- cgit v1.2.3