blob: 24bc1a16708ff6fa706358d28a65123ddcc7f795 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
import { type ForwardRefRenderFunction, forwardRef } from 'react';
import { Section, type SectionProps } from '../../atoms';
import styles from './page.module.scss';
export type PageSectionVariant = 'dark' | 'light';
export type PageSectionProps = SectionProps & {
/**
* Add a border at the bottom of the section.
*
* @default false
*/
hasBorder?: boolean;
/**
* The section variant.
*
* @default 'light'
*/
variant?: PageSectionVariant;
};
const PageSectionWithRef: ForwardRefRenderFunction<
HTMLElement,
PageSectionProps
> = (
{ children, className = '', hasBorder = false, variant = 'light', ...props },
ref
) => {
const sectionClass = [
styles.section,
styles[hasBorder ? 'section--bordered' : ''],
styles[`section--${variant}`],
className,
].join(' ');
return (
<Section {...props} className={sectionClass} ref={ref}>
<div className={styles.section__body}>{children}</div>
</Section>
);
};
export const PageSection = forwardRef(PageSectionWithRef);
|