import React, { FC, useEffect } from 'react'; import { Form, Button, ButtonGroup } from 'reactstrap'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faMoon, faSun, faAdjust } from '@fortawesome/free-solid-svg-icons'; import { useTheme } from './contexts/ThemeContext'; export const themeLocalStorageKey = 'user-prefers-color-scheme'; export const Theme: FC = () => { const { theme } = useTheme(); useEffect(() => { document.body.classList.toggle('bootstrap-dark', theme === 'dark'); document.body.classList.toggle('bootstrap', theme === 'light'); }, [theme]); return null; }; export const ThemeToggle: FC = () => { const { userPreference, setTheme } = useTheme(); return (
); };