2022-10-17 23:37:01 +08:00
|
|
|
import siteMetadata from '@/data/siteMetadata';
|
|
|
|
import headerNavLinks from '@/data/headerNavLinks';
|
|
|
|
import Logo from '@/data/logo.svg';
|
|
|
|
import Link from './Link';
|
|
|
|
import SectionContainer from './SectionContainer';
|
|
|
|
import Footer from './Footer';
|
|
|
|
import MobileNav from './MobileNav';
|
|
|
|
import ThemeSwitch from './ThemeSwitch';
|
|
|
|
import { ReactNode } from 'react';
|
2022-07-17 21:40:41 +08:00
|
|
|
|
2022-10-07 13:55:39 +08:00
|
|
|
interface Props {
|
2022-10-17 23:37:01 +08:00
|
|
|
children: ReactNode;
|
2022-10-07 13:55:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const LayoutWrapper = ({ children }: Props) => {
|
2022-07-17 21:40:41 +08:00
|
|
|
return (
|
|
|
|
<SectionContainer>
|
|
|
|
<div className="flex h-screen flex-col justify-between">
|
|
|
|
<header className="flex items-center justify-between py-10">
|
|
|
|
<div>
|
|
|
|
<Link href="/" aria-label={siteMetadata.headerTitle}>
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
<div className="mr-3">
|
|
|
|
<Logo />
|
|
|
|
</div>
|
|
|
|
{typeof siteMetadata.headerTitle === 'string' ? (
|
|
|
|
<div className="hidden h-6 text-2xl font-semibold sm:block">
|
|
|
|
{siteMetadata.headerTitle}
|
|
|
|
</div>
|
|
|
|
) : (
|
|
|
|
siteMetadata.headerTitle
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</Link>
|
|
|
|
</div>
|
|
|
|
<div className="flex items-center text-base leading-5">
|
|
|
|
<div className="hidden sm:block">
|
|
|
|
{headerNavLinks.map((link) => (
|
|
|
|
<Link
|
|
|
|
key={link.title}
|
|
|
|
href={link.href}
|
2022-10-17 23:37:01 +08:00
|
|
|
className="p-1 font-medium text-gray-900 dark:text-gray-100 sm:p-4">
|
2022-07-17 21:40:41 +08:00
|
|
|
{link.title}
|
|
|
|
</Link>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
<ThemeSwitch />
|
|
|
|
<MobileNav />
|
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
<main className="mb-auto">{children}</main>
|
|
|
|
<Footer />
|
|
|
|
</div>
|
|
|
|
</SectionContainer>
|
2022-10-17 23:37:01 +08:00
|
|
|
);
|
|
|
|
};
|
2022-07-17 21:40:41 +08:00
|
|
|
|
2022-10-17 23:37:01 +08:00
|
|
|
export default LayoutWrapper;
|