import { useTheme } from './useTheme.ts';
import styles from './themeSwitch.module.css';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faMoon, faSun } from '@fortawesome/free-solid-svg-icons';


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

  return (
          <button className={styles.button} onClick={toggleTheme} aria-label="Toggle dark mode">
        {theme === 'dark' ? (
            <FontAwesomeIcon icon={faSun}/>
        ) : (
            <FontAwesomeIcon icon={faMoon}/>
        )}
      </button>
  );
};

export default ThemeToggleButton;
