aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/templates/page/page-section.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/templates/page/page-section.tsx')
-rw-r--r--src/components/templates/page/page-section.tsx43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/components/templates/page/page-section.tsx b/src/components/templates/page/page-section.tsx
new file mode 100644
index 0000000..24bc1a1
--- /dev/null
+++ b/src/components/templates/page/page-section.tsx
@@ -0,0 +1,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);