Refactor layout and navigation components; remove theme toggler

- Updated layout.tsx to remove the ThemeProvider and directly include Analytics, SpeedInsights, and Navigation components.
- Removed ThemeToggler component from Navigation.
- Adjusted global CSS to use media queries for dark theme styles instead of data attributes.
- Cleaned up package.json by removing the next-themes dependency.
This commit is contained in:
2024-12-24 01:34:32 -05:00
parent 40e3ff220c
commit 8a13b5a166
8 changed files with 3263 additions and 1675 deletions

2
next-env.d.ts vendored
View File

@@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View File

@@ -33,7 +33,6 @@
"geist": "^1.3.1",
"lucide-react": "^0.454.0",
"next": "^15.0.2",
"next-themes": "^0.3.0",
"pdfjs-dist": "^4.9.155",
"radix-ui": "^1.0.1",
"react": "^18.3.1",

3091
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

1725
public/stats.html Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,5 @@
import { Analytics } from "@vercel/analytics/react"
import { SpeedInsights } from "@vercel/speed-insights/next"
import { ThemeProvider } from "next-themes"
import { Footer } from "~/components/Footer"
import { Navigation } from "~/components/Navigation"
import { Sidebar } from "~/components/Sidebar"
@@ -18,12 +17,6 @@ export default function RootLayout({ children }: React.PropsWithChildren) {
return (
<html lang="en" className={inter.className} suppressHydrationWarning>
<body className="font-sans bg-background text-foreground min-h-screen flex flex-col" suppressHydrationWarning>
<ThemeProvider
attribute="data-theme"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
<Analytics />
<SpeedInsights />
<Navigation />
@@ -40,7 +33,6 @@ export default function RootLayout({ children }: React.PropsWithChildren) {
</div>
</div>
<Footer />
</ThemeProvider>
</body>
</html >
)

View File

@@ -4,7 +4,6 @@ import { BookOpenText, FileText, FolderGit2, Home, Menu, Newspaper, Plane, X } f
import { usePathname } from 'next/navigation';
import Link from 'next/link';
import { useEffect, useState } from 'react';
import { ThemeToggler } from '~/components/ThemeToggler';
const navItems = [
{ href: '/', label: 'About', icon: Home },
@@ -45,7 +44,6 @@ export function Navigation() {
);
})}
</div>
<ThemeToggler />
<button
onClick={() => setIsOpen(!isOpen)}
className="text-gray-500 hover:text-primary focus:outline-none relative h-6 w-6 lg:hidden"

View File

@@ -1,31 +0,0 @@
'use client';
import { Sun, Moon, SunMoon } from 'lucide-react';
import { useTheme } from 'next-themes';
import { useEffect, useState } from 'react';
export function ThemeToggler() {
const { theme, setTheme } = useTheme();
const [mounted, setMounted] = useState(false);
// Only show theme switcher after mounting to prevent hydration mismatch
useEffect(() => {
setMounted(true);
}, []);
// Determine the icon to display based on the current theme
const themeIcon = mounted ? (theme === 'dark' ? <Sun size={20} /> : <Moon size={20} />) : <SunMoon size={20} />;
return (
<button
onClick={() => {
const newTheme = theme === 'dark' ? 'light' : 'dark';
setTheme(newTheme);
}}
className="text-sm font-medium text-muted-foreground hover:text-primary flex items-center"
aria-label="Toggle theme"
>
{themeIcon}
</button>
);
}

View File

@@ -28,7 +28,8 @@
--shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}
[data-theme='dark'] {
@media (prefers-color-scheme: dark) {
:root {
--background: 0 0% 10%;
--foreground: 0 0% 90%;
--card: 0 0% 12%;
@@ -52,6 +53,7 @@
--shadow: 0 1px 3px rgba(255, 255, 255, 0.1), 0 1px 2px rgba(255, 255, 255, 0.06);
}
}
}
.border {
border: 1px solid hsl(var(--border));