Created
April 17, 2020 17:56
-
-
Save bufordeeds/ce69228b7300f655eafb7969fdd896f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | |
import './toggle.css'; | |
export const Toggle = ({ darkMode, toggleDarkMode }) => { | |
return ( | |
<span id='dark_mode_toggle'> | |
<FontAwesomeIcon | |
icon={ | |
darkMode ? | |
'sun' : | |
'moon' | |
} | |
onClick={() => toggleDarkMode(!darkMode)} | |
aria-label={darkMode ? 'Toggle dark mode off ': 'Toggle dark mode on'} /> | |
</span> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment