22 lines
497 B
React
22 lines
497 B
React
import React from 'react';
|
|
import { useTheme } from './ThemeContext';
|
|
|
|
const ThemeButton = ({ children, onClick }) => {
|
|
const { theme } = useTheme();
|
|
|
|
const buttonStyle = {
|
|
backgroundColor: theme === 'light' ? '#fff' : '#333',
|
|
color: theme === 'light' ? '#000' : '#fff',
|
|
border: '1px solid #ccc',
|
|
padding: '10px 20px',
|
|
cursor: 'pointer',
|
|
};
|
|
|
|
return (
|
|
<button style={buttonStyle} onClick={onClick}>
|
|
{children}
|
|
</button>
|
|
);
|
|
};
|
|
|
|
export default ThemeButton; |