aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/layout/columns.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-18 19:25:02 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:14:41 +0100
commit94448fa278ab352a741ff13f22d6104869571144 (patch)
tree2185e77f2866d11a0144d4ac5a01c71a76807341 /src/components/molecules/layout/columns.tsx
parentc153f93dc8691a71dc76aad3dd618298da9d238a (diff)
feat(components): add a generic Grid component
* merge Columns, Gallery and CardsList into Grid component * add more options to control the grid
Diffstat (limited to 'src/components/molecules/layout/columns.tsx')
-rw-r--r--src/components/molecules/layout/columns.tsx62
1 files changed, 0 insertions, 62 deletions
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<HTMLDivElement> & {
- children: ReactNode;
-};
-
-/**
- * Column component.
- *
- * Render the body as a column.
- */
-export const Column: FC<ColumnProps> = ({ children, ...props }) => (
- <div {...props}>{children}</div>
-);
-
-// eslint-disable-next-line @typescript-eslint/no-magic-numbers
-type ColumnsNumber = 2 | 3 | 4;
-
-export type ColumnsProps = {
- /**
- * The columns.
- */
- children: ReactComponentElement<typeof Column>[];
- /**
- * 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<ColumnsProps> = ({
- 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 <div className={wrapperClass}>{children}</div>;
-};