diff --git a/index.html b/index.html index 96341399..6347e08e 100644 --- a/index.html +++ b/index.html @@ -7,41 +7,12 @@ Deriv Bot - +
diff --git a/src/components/layout/footer/ChangeTheme.tsx b/src/components/layout/footer/ChangeTheme.tsx index 0eb5c633..6453077a 100644 --- a/src/components/layout/footer/ChangeTheme.tsx +++ b/src/components/layout/footer/ChangeTheme.tsx @@ -1,15 +1,38 @@ -import { LegacyThemeLightIcon } from '@deriv/quill-icons'; +import { useState } from 'react'; +import { LegacyThemeDarkIcon, LegacyThemeLightIcon } from '@deriv/quill-icons'; import { useTranslations } from '@deriv-com/translations'; import { Tooltip } from '@deriv-com/ui'; const ChangeTheme = () => { const { localize } = useTranslations(); + const [current_theme, setCurrentTheme] = useState(localStorage.getItem('theme') ?? 'light'); + + const toggleTheme = () => { + const body = document.querySelector('body'); + if (!body) return; + if (body.classList.contains('theme--dark')) { + localStorage.setItem('theme', 'light'); + body.classList.remove('theme--dark'); + body.classList.add('theme--light'); + setCurrentTheme('light'); + } else { + localStorage.setItem('theme', 'dark'); + body.classList.remove('theme--light'); + body.classList.add('theme--dark'); + setCurrentTheme('dark'); + } + }; return ( // TODO need to add theme logic // TODO update the component's tests after adding the logic - - + + {current_theme === 'light' ? : } ); }; diff --git a/src/components/layout/main-body/index.tsx b/src/components/layout/main-body/index.tsx index 95aad800..1ecfceae 100644 --- a/src/components/layout/main-body/index.tsx +++ b/src/components/layout/main-body/index.tsx @@ -5,7 +5,7 @@ type TMainBodyProps = { }; const MainBody: React.FC = ({ children }) => { - return
{children}
; + return
{children}
; }; export default MainBody;