Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,18 @@ export default function RootLayout({
}) {
return (
<html lang="en" className={`${font.variable} ${font2.variable}`}>
<body className="h-screen flex flex-col font-body overflow-x-hidden bg-base-950 text-base-100">
<body className="min-h-screen font-body overflow-x-hidden bg-base-950 text-base-100">
<Analytics />
<Header />
<ContextMenu />
<main className="max-w-xl w-full mx-auto px-4 mb-12 mt-8">
{children}
</main>
<Footer />
<div className="mx-auto flex min-h-screen w-full max-w-6xl flex-col md:flex-row md:items-start">
<Header />
<div className="flex min-h-screen flex-1 flex-col">
<main className="mt-8 mb-12 w-full max-w-xl px-4 md:mt-12 md:px-6">
{children}
</main>
<Footer />
</div>
</div>
</body>
</html>
)
Expand Down
71 changes: 42 additions & 29 deletions components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,57 @@ export default function Header() {
const isRootPage = pathname === '/'

return (
<div className="py-4 px-4 mx-auto w-full max-w-xl text-base-800 dark:text-base-50 flex flex-row justify-between items-center gap-y-4 md:gap-y-0">
{!isRootPage && (
<div className="flex flex-col justify-center">
<Link
href="/"
className="hover:text-accent-600 text-base-300 transition-all"
>
<h1 className="-mb-1 font-bold hidden">Chris Jarling</h1>
<ViewTransition name="avatar">
<Image
src="/dithered.png"
alt="Chris Jarling"
width={48}
height={48}
className="rounded-lg border border-base-900 w-12 h-12 grayscale-50 hover:grayscale-0 transition-all"
/>
</ViewTransition>
</Link>
</div>
)}
<nav className="ml-auto">
<div className="gap-2 flex justify-center items-center">
<NavLink href="/about">About</NavLink>
<NavLink href="/now">Now</NavLink>
</div>
</nav>
</div>
<aside className="w-full px-4 py-4 md:w-56 md:shrink-0 md:px-8 md:py-8">
<div className="flex flex-row items-center justify-between gap-4 md:sticky md:top-8 md:flex-col md:items-start md:justify-start">
{!isRootPage && (
<div className="flex flex-col justify-center">
<Link
href="/"
className="hover:text-accent-600 text-base-300 transition-all"
>
<h1 className="-mb-1 font-bold hidden">Chris Jarling</h1>
<ViewTransition name="avatar">
<Image
src="/dithered.png"
alt="Chris Jarling"
width={48}
height={48}
className="rounded-lg border border-base-900 w-12 h-12 grayscale-50 hover:grayscale-0 transition-all"
/>
</ViewTransition>
</Link>
</div>
)}
<nav aria-label="Main navigation">
<div className="flex items-center gap-2 md:flex-col md:items-start">
<NavLink href="/about" pathname={pathname}>
About
</NavLink>
<NavLink href="/now" pathname={pathname}>
Now
</NavLink>
</div>
</nav>
</div>
</aside>
)
}

type NavLinkProps = {
children: React.ReactNode
pathname: string
} & LinkProps

const NavLink = ({ children, ...rest }: NavLinkProps) => {
const NavLink = ({ children, pathname, ...rest }: NavLinkProps) => {
const isActive = pathname === rest.href

return (
<Link
className="font-title transition-all text-base-500 hover:bg-base-800 hover:text-base-200 px-4 py-2 rounded-full"
className={`font-title transition-all px-4 py-2 rounded-full md:w-full ${
isActive
? 'bg-base-800 text-base-100'
: 'text-base-500 hover:bg-base-800 hover:text-base-200'
}`}
{...rest}
>
{children}
Expand Down
Loading