From 44e446c483476e2c36f7754462eedf685385da9f Mon Sep 17 00:00:00 2001 From: Neshura Date: Fri, 16 Dec 2022 22:58:46 +0100 Subject: [PATCH] Auto close theme selector --- components/themeselector.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/themeselector.tsx b/components/themeselector.tsx index e3e6ec1..8e771a6 100644 --- a/components/themeselector.tsx +++ b/components/themeselector.tsx @@ -45,9 +45,16 @@ export const StyleSelector = () => { const [test, setTest] = useState(false); + function handleBlur(event:any) { + console.log(event) + if (!event.currentTarget.contains(event.relatedTarget)) { + setTest(false); + } + } + return ( - + handleBlur(event)}> setTest(test => !test)}>{selectedTheme.themeName} {themes.map((theme) => (