diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-10-02 17:39:16 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-11 18:14:41 +0100 |
| commit | 6221fa82e41915702d8139cade5c25e9d61e619f (patch) | |
| tree | 9c725b7f7b1e002747712de456c73f28839f0ebd /src/components/molecules/layout/columns.tsx | |
| parent | 36890cfafeba6e30782df1260d7f9e678c7da4bf (diff) | |
refactor(components): remove Column and NoScript from atoms
* Column is a simple div meant to be used inside Columns component so
they should live together.
* NoScript is only used in Layout component and its name does not
make sense since it needs to be used inside a `noscript` element.
Diffstat (limited to 'src/components/molecules/layout/columns.tsx')
| -rw-r--r-- | src/components/molecules/layout/columns.tsx | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/components/molecules/layout/columns.tsx b/src/components/molecules/layout/columns.tsx index b5bd9b5..56cd1a1 100644 --- a/src/components/molecules/layout/columns.tsx +++ b/src/components/molecules/layout/columns.tsx @@ -1,7 +1,27 @@ -import { FC, ReactComponentElement } from 'react'; -import { Column } from '../../atoms'; +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. @@ -14,7 +34,7 @@ export type ColumnsProps = { /** * The number of columns. */ - count: 2 | 3 | 4; + count: ColumnsNumber; /** * Should the columns be stacked on small devices? Default: true. */ |
