From 5fd16571c7e4c069068248b105f779f8fb01af44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Sat, 5 Jun 2021 21:25:07 +0200 Subject: [PATCH] Create SwitchTheme component --- components/switch-theme.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 components/switch-theme.js diff --git a/components/switch-theme.js b/components/switch-theme.js new file mode 100644 index 0000000..c806b6c --- /dev/null +++ b/components/switch-theme.js @@ -0,0 +1,24 @@ +import PropTypes from 'prop-types' +import WbSunnyIcon from '@material-ui/icons/WbSunny' +import Brightness3Icon from '@material-ui/icons/Brightness3' + +export default function SwitchTheme({darkMode, setDarkMode}) { + const handleClick = () => { + setDarkMode(!darkMode) + } + + return ( +
+ {darkMode ? ( + + ) : ( + + )} +
+ ) +} + +SwitchTheme.propTypes = { + darkMode: PropTypes.bool.isRequired, + setDarkMode: PropTypes.func.isRequired +}