Skip to content
Open
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
6 changes: 6 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@
html {
@apply font-sans;
}
:root {
color-scheme: light;
}
.dark {
color-scheme: dark;
}
}

/* Scrollbar styling */
Expand Down
8 changes: 6 additions & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import { AppShell } from "@/components/layout/AppShell";
import { ThemeProvider } from "@/components/ThemeProvider";
import "./globals.css";

const geistSans = Geist({
Expand Down Expand Up @@ -31,10 +32,13 @@ export default function RootLayout({
return (
<html
lang="en"
className={`${geistSans.variable} ${geistMono.variable} dark h-full antialiased`}
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
suppressHydrationWarning
>
<body className="h-full bg-background text-foreground">
<AppShell>{children}</AppShell>
<ThemeProvider>
<AppShell>{children}</AppShell>
</ThemeProvider>
</body>
</html>
);
Expand Down
22 changes: 22 additions & 0 deletions components/ThemeProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use client";

import { ThemeProvider as NextThemesProvider } from "next-themes";

type Props = { children: React.ReactNode };

/**
* `theme` / `light` | `dark` in localStorage (default dark, no system theme) — matches aauth.dev site.
*/
export function ThemeProvider({ children }: Props) {
return (
<NextThemesProvider
attribute="class"
defaultTheme="dark"
enableSystem={false}
storageKey="theme"
themes={["dark", "light"]}
>
{children}
</NextThemesProvider>
);
}
41 changes: 41 additions & 0 deletions components/ThemeToggle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"use client";

import { Moon, Sun } from "lucide-react";
import { useTheme } from "next-themes";
import { useEffect, useState } from "react";

export function ThemeToggle() {
const { resolvedTheme, setTheme } = useTheme();
const [mounted, setMounted] = useState(false);

useEffect(() => {
setMounted(true);
}, []);

if (!mounted) {
return (
<span
className="inline-flex h-9 w-9 shrink-0 items-center justify-center"
aria-hidden
/>
);
}

const isDark = resolvedTheme === "dark";

return (
<button
type="button"
onClick={() => setTheme(isDark ? "light" : "dark")}
className="inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
title={isDark ? "Light theme" : "Dark theme"}
aria-label={isDark ? "Switch to light theme" : "Switch to dark theme"}
>
{isDark ? (
<Sun className="h-5 w-5" aria-hidden />
) : (
<Moon className="h-5 w-5" aria-hidden />
)}
</button>
);
}
4 changes: 3 additions & 1 deletion components/layout/AppShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Link from "next/link";
import { useState } from "react";
import { Menu } from "lucide-react";
import { Sidebar } from "./Sidebar";
import { ThemeToggle } from "@/components/ThemeToggle";

const EXT_LINKS = [
{ label: "AAuth.dev", href: "https://aauth.dev" },
Expand Down Expand Up @@ -50,7 +51,8 @@ export function AppShell({ children }: { children: React.ReactNode }) {
<img src="/logo.svg" alt="AAuth Explorer" className="h-5 w-auto" />
</Link>
</div>
<nav className="flex items-center gap-5 -mb-1.5">
<nav className="flex items-center gap-2 sm:gap-3 -mb-1.5">
<ThemeToggle />
{EXT_LINKS.map((link) => (
<a
key={link.href}
Expand Down
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"framer-motion": "^12.38.0",
"lucide-react": "^1.8.0",
"next": "16.2.3",
"next-themes": "^0.4.6",
"prism-react-renderer": "^2.4.1",
"react": "19.2.4",
"react-dom": "19.2.4",
Expand Down