/
som_cooper
/
book-lib
Обзор
Документация
Войти
/
som_cooper
/
book-lib
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
admin/src/components/layout/ThemeToggleButton.jsx
25 строк
829 B
imdbcooper
feat(admin): redesign UI with shadcn/ui, unified search, compact density
23 май 2026, 19:58
23 май 2026, 19:58
afbd27f
Код
Авторство
О чём код?
import { Moon, Sun } from 'lucide-react' import { Button } from '../ui/button.jsx' import { useTheme } from '../theme-context.js' export default function ThemeToggleButton() { const { resolvedTheme, setTheme } = useTheme() const isDark = resolvedTheme === 'dark' const next = isDark ? 'light' : 'dark' return ( <Button type="button" variant="ghost" size="icon" className="h-8 w-8" onClick={() => setTheme(next)} title={isDark ? 'Switch to light' : 'Switch to dark'} aria-label="Toggle theme" > <Sun className="h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" /> <Moon className="absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" /> <span className="sr-only">Toggle theme</span> </Button> ) }