Spaces:
Running
Running
Download bioai-platform/frontend/src/components/ui/ThemeToggle.tsx from Samad14/bio-nexus-api: direct link, hf CLI and curl.
- Browser
- Download file 820 Bytes
-
https://huggingface.co/spaces/Samad14/bio-nexus-api/resolve/main/bioai-platform/frontend/src/components/ui/ThemeToggle.tsx
- Command line
-
hf download hf://spaces/Samad14/bio-nexus-api/bioai-platform/frontend/src/components/ui/ThemeToggle.tsx
-
curl -L -o ThemeToggle.tsx https://huggingface.co/spaces/Samad14/bio-nexus-api/resolve/main/bioai-platform/frontend/src/components/ui/ThemeToggle.tsx
820 Bytes
| 'use client'; | |
| import { Moon, Sun } from '@phosphor-icons/react'; | |
| import { useTheme } from '@/contexts/theme'; | |
| export function ThemeToggle({ className = '' }: { className?: string }) { | |
| const { theme, toggleTheme } = useTheme(); | |
| const isDark = theme === 'dark'; | |
| return ( | |
| <button | |
| onClick={toggleTheme} | |
| aria-label={isDark ? 'Switch to light theme' : 'Switch to dark theme'} | |
| title={isDark ? 'Switch to light theme' : 'Switch to dark theme'} | |
| className={`flex items-center justify-center w-11 h-11 rounded-full border border-glass-border bg-surface-1/70 text-text-secondary hover:text-accent-cyan hover:border-accent-cyan/40 transition-colors cursor-pointer ${className}`} | |
| > | |
| {isDark ? <Sun size={17} weight="regular" /> : <Moon size={17} weight="regular" />} | |
| </button> | |
| ); | |
| } | |