Skip to content

Commit

Permalink
feat: Add ThemeToggleButton component for dark mod
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Feb 12, 2024
1 parent bee1eb9 commit e70ba28
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/components/ThemeToggleButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import { useTheme } from '../context/ThemeContext';

const ThemeToggleButton = () => {
const { theme, toggleTheme } = useTheme();

return (
<button
onClick={toggleTheme}
style={{
padding: '10px 20px',
fontSize: '16px',
cursor: 'pointer',
backgroundColor: theme === 'light' ? '#FFF' : '#333',
color: theme === 'light' ? '#333' : '#FFF',
border: `2px solid ${theme === 'light' ? '#333' : '#FFF'}`,
borderRadius: '5px',
transition: 'all 0.3s ease',
}}
>
{theme === 'light' ? 'Switch to Dark Mode' : 'Switch to Light Mode'}
</button>
);
};

export default ThemeToggleButton;

0 comments on commit e70ba28

Please sign in to comment.