diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-11-22 19:07:25 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-23 11:44:28 +0100 |
| commit | 4f1181581e177dd80a76165a0f930ef4577f9c6a (patch) | |
| tree | 6029f86d42af7700f5b59cd1477854190bab65c6 /src/components/atoms/layout/section/section.tsx | |
| parent | 329e7c89bac50be9db2c6d2ec6751ab0ffad42ac (diff) | |
refactor(components): integrate sectioned page template into Page
* replace Section component by a generic one (other components should
be able to use it)
* add a PageSection component
* add `hasSections` prop to Page component
* remove sectioned-page template
Diffstat (limited to 'src/components/atoms/layout/section/section.tsx')
| -rw-r--r-- | src/components/atoms/layout/section/section.tsx | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/src/components/atoms/layout/section/section.tsx b/src/components/atoms/layout/section/section.tsx index 63c658a..63a2499 100644 --- a/src/components/atoms/layout/section/section.tsx +++ b/src/components/atoms/layout/section/section.tsx @@ -2,45 +2,18 @@ import { forwardRef, type ForwardRefRenderFunction, type HTMLAttributes, - type ReactNode, } from 'react'; -import styles from './section.module.scss'; -export type SectionVariant = 'dark' | 'light'; - -export type SectionProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & { - /** - * The section content. - */ - children: ReactNode | ReactNode[]; - /** - * Add a border at the bottom of the section. - * - * @default false - */ - hasBorder?: boolean; - /** - * The section variant. - * - * @default 'light' - */ - variant?: SectionVariant; -}; +export type SectionProps = HTMLAttributes<HTMLElement>; const SectionWithRef: ForwardRefRenderFunction<HTMLElement, SectionProps> = ( - { children, className = '', hasBorder = false, variant = 'light', ...props }, + { children, ...props }, ref -) => { - const borderClass = hasBorder ? styles[`wrapper--borders`] : ''; - const variantClass = styles[`wrapper--${variant}`]; - const sectionClass = `${styles.wrapper} ${borderClass} ${variantClass} ${className}`; - - return ( - <section {...props} className={sectionClass} ref={ref}> - {children} - </section> - ); -}; +) => ( + <section {...props} ref={ref}> + {children} + </section> +); /** * Section component |
