From d4045fbcbfa8208ec31539744417f315f1f6fad8 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Tue, 21 Nov 2023 19:01:18 +0100
Subject: refactor(components): split Layout component in smaller components

The previous component was too long and hardly readable. So I splitted
it in different part and added tests.
---
 .../templates/layout/site-header/site-header.tsx   | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 src/components/templates/layout/site-header/site-header.tsx

(limited to 'src/components/templates/layout/site-header/site-header.tsx')

diff --git a/src/components/templates/layout/site-header/site-header.tsx b/src/components/templates/layout/site-header/site-header.tsx
new file mode 100644
index 0000000..3e06350
--- /dev/null
+++ b/src/components/templates/layout/site-header/site-header.tsx
@@ -0,0 +1,25 @@
+import { type ForwardRefRenderFunction, forwardRef } from 'react';
+import { Header, type HeaderProps } from '../../../atoms';
+import { SiteBranding } from './site-branding';
+import styles from './site-header.module.scss';
+import { SiteNavbar } from './site-navbar';
+
+export type SiteHeaderProps = Omit<HeaderProps, 'children'> & {
+  isHome?: boolean;
+};
+
+const SiteHeaderWithRef: ForwardRefRenderFunction<
+  HTMLElement,
+  SiteHeaderProps
+> = ({ className = '', isHome = false, ...props }, ref) => {
+  const headerClass = `${styles.header} ${className}`;
+
+  return (
+    <Header {...props} className={headerClass} ref={ref}>
+      <SiteBranding className={styles.branding} isHome={isHome} />
+      <SiteNavbar className={styles.navbar} />
+    </Header>
+  );
+};
+
+export const SiteHeader = forwardRef(SiteHeaderWithRef);
-- 
cgit v1.2.3

