dark mode

This commit is contained in:
TwperBody
2025-08-10 22:17:06 +08:00
parent eb7b5dcc25
commit 2aef139577
35 changed files with 450 additions and 113 deletions

View File

@@ -0,0 +1,18 @@
'use client';
import { ThemeProvider as NextThemesProvider } from 'next-themes';
import { type ThemeProviderProps } from 'next-themes/dist/types';
export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
return (
<NextThemesProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
{...props}
>
{children}
</NextThemesProvider>
);
}

View File

@@ -76,7 +76,7 @@ function PaginationPrevious({
className={cn('gap-1 px-2.5 sm:pl-2.5', className)}
{...props}
>
<ChevronLeftIcon className="text-black" />
<ChevronLeftIcon className="text-black dark:text-white" />
<span className="hidden sm:block"></span>
</PaginationLink>
);
@@ -94,7 +94,7 @@ function PaginationNext({
{...props}
>
<span className="hidden sm:block"></span>
<ChevronRightIcon className="text-black" />
<ChevronRightIcon className="text-black dark:text-white" />
</PaginationLink>
);
}

View File

@@ -0,0 +1,24 @@
'use client';
import * as React from 'react';
import { Moon, Sun } from 'lucide-react';
import { useTheme } from 'next-themes';
import { Button } from '@/components/ui/button';
export function ThemeToggle() {
const { theme, setTheme } = useTheme();
return (
<Button
variant="outline"
size="icon"
onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}
className="h-9 w-9"
>
<Sun className="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
<Moon className="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
<span className="sr-only"></span>
</Button>
);
}