Closed iamalaziz closed 1 year ago
import useSound from 'use-sound' import switchOn from '../assets/switch-on.mp3'
const [playSwitchOn] = useSound(switchOn)
const switchTheme = () => { setTheme(theme === 'dark' || resolvedTheme === 'dark' ? 'light' : 'dark') playSwitchOn() }
<button aria-label="Toggle Dark Mode" type="button" className="flex h-8 w-8 items-center justify-center p-2" onClick={switchTheme} >
import useSound from 'use-sound' import switchOn from '../assets/switch-on.mp3'
const [playSwitchOn] = useSound(switchOn)
const switchTheme = () => { setTheme(theme === 'dark' || resolvedTheme === 'dark' ? 'light' : 'dark') playSwitchOn() }