From 97acd1c5fe65859de76d54c7832b62fff4dca089 Mon Sep 17 00:00:00 2001 From: Neshura Date: Sun, 18 Dec 2022 04:56:51 +0100 Subject: [PATCH] Adjusted Styling on Theme Selector Button --- components/themeselector.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/themeselector.tsx b/components/themeselector.tsx index f395038..eb4fee9 100644 --- a/components/themeselector.tsx +++ b/components/themeselector.tsx @@ -6,7 +6,7 @@ import { ThemeDropDown, ThemeDropDownButton, ThemeDropDownOption, ThemeDropDownO import Themes from '../public/data/themes.json'; export const StyleSelector = () => { - const themes = Themes.themes; + const themes: DefaultTheme[] = Themes.themes; const updateTheme = useUpdateTheme(); const currentTheme = useContext(ThemeContext); const [selectedTheme, setSelectedTheme] = useState(themes[currentTheme.themeId]); @@ -35,16 +35,19 @@ export const StyleSelector = () => { } const [visible, setVisible] = useState(false); + const [buttonFocus, setButtonFocus] = useState(visible); function handleBlur(event:any) { if (!event.currentTarget.contains(event.relatedTarget)) { + setButtonFocus(false); setVisible(false); } } return ( handleBlur(event)}> - setVisible(visible => !visible)}>{selectedTheme.themeName} + setButtonFocus(true)} onClick={() => setVisible(visible => !visible)}>{selectedTheme.themeName} + {themes.map((theme) => ( updateThemeWithStorage(theme)}>