From 6519bec401c2a8f26acab455d2d01f8d68a77052 Mon Sep 17 00:00:00 2001 From: Sahas Date: Fri, 27 Oct 2023 13:13:19 +0530 Subject: [PATCH] feat: switcher dark mode to light mode --- pages/_app.tsx | 5 +--- public/assets/icons/darkmodeswitcher.svg | 3 +++ public/assets/icons/lightmodeswitcher.svg | 10 ++++++++ src/components/AppLayout/index.tsx | 3 ++- src/ui-components/ToggleButton/index.tsx | 30 +++++++++++++++++++++++ tailwind.config.js | 1 + 6 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 public/assets/icons/darkmodeswitcher.svg create mode 100644 public/assets/icons/lightmodeswitcher.svg create mode 100644 src/ui-components/ToggleButton/index.tsx diff --git a/pages/_app.tsx b/pages/_app.tsx index 5738b83d78..bea0ad2284 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -83,10 +83,7 @@ function App({ Component, pageProps }: AppProps) { return ( - + diff --git a/public/assets/icons/darkmodeswitcher.svg b/public/assets/icons/darkmodeswitcher.svg new file mode 100644 index 0000000000..76320a7d7f --- /dev/null +++ b/public/assets/icons/darkmodeswitcher.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/assets/icons/lightmodeswitcher.svg b/public/assets/icons/lightmodeswitcher.svg new file mode 100644 index 0000000000..184cfd00f4 --- /dev/null +++ b/public/assets/icons/lightmodeswitcher.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/components/AppLayout/index.tsx b/src/components/AppLayout/index.tsx index 90ab1d8e93..4f7668a03b 100644 --- a/src/components/AppLayout/index.tsx +++ b/src/components/AppLayout/index.tsx @@ -69,6 +69,7 @@ import { useDispatch } from 'react-redux'; import { logout } from '~src/redux/userDetails'; import { useTheme } from 'next-themes'; import { Dropdown } from '~src/ui-components/Dropdown'; +import ToggleButton from '~src/ui-components/ToggleButton'; const OnChainIdentity = dynamic(() => import('~src/components/OnchainIdentity'), { ssr: false @@ -695,7 +696,7 @@ const AppLayout = ({ className, Component, pageProps }: Props) => { if (isMobile) { sidebarItems = [getSiderMenuItem('', '',
), username && isMobile ? userDropdown : null, ...sidebarItems]; } - + sidebarItems.push(getSiderMenuItem('', '', )); return ( { + const { resolvedTheme: theme, setTheme } = useTheme(); + + return ( + + ); +}; + +export default ToggleButton; diff --git a/tailwind.config.js b/tailwind.config.js index 932c697748..b50ed1575f 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -5,6 +5,7 @@ /* eslint-disable sort-keys */ module.exports = { important: true, + darkMode: 'class', content: ['./pages/**/*.{js,ts,jsx,tsx}', './src/**/*.{jsx,tsx}'], theme: { extend: {