turash/bugulma/frontend/components/ui/ThemeToggle.tsx
Damir Mukimov 6347f42e20
Consolidate repositories: Remove nested frontend .git and merge into main repository
- Remove nested git repository from bugulma/frontend/.git
- Add all frontend files to main repository tracking
- Convert from separate frontend/backend repos to unified monorepo
- Preserve all frontend code and development history as tracked files
- Eliminate nested repository complexity for simpler development workflow

This creates a proper monorepo structure with frontend and backend
coexisting in the same repository for easier development and deployment.
2025-11-25 06:02:57 +01:00

39 lines
1.1 KiB
TypeScript

import React from 'react';
import { motion, AnimatePresence } from 'framer-motion';
import { useTheme } from '@/contexts/ThemeContext.tsx';
import Button from '@/components/ui/Button.tsx';
import { Moon, Sun } from 'lucide-react';
const ThemeToggle = () => {
const { theme, setTheme } = useTheme();
const toggleTheme = () => {
setTheme(theme === 'dark' ? 'light' : 'dark');
};
return (
<Button
variant="ghost"
size="sm"
className="w-9 h-9 p-0"
onClick={toggleTheme}
aria-label="Toggle theme"
>
<AnimatePresence mode="wait" initial={false}>
<motion.span
key={theme}
initial={{ y: -20, opacity: 0, rotate: -90 }}
animate={{ y: 0, opacity: 1, rotate: 0 }}
exit={{ y: 20, opacity: 0, rotate: 90 }}
transition={{ duration: 0.2 }}
className="flex items-center justify-center"
>
{theme === 'dark' ? <Sun className="h-4 h-5 text-current w-4 w-5" /> : <Moon className="h-4 h-5 text-current w-4 w-5" />}
</motion.span>
</AnimatePresence>
</Button>
);
};
export default ThemeToggle;