Auto close theme selector
This commit is contained in:
parent
2ec2f70772
commit
44e446c483
1 changed files with 8 additions and 1 deletions
|
@ -45,9 +45,16 @@ export const StyleSelector = () => {
|
||||||
|
|
||||||
const [test, setTest] = useState(false);
|
const [test, setTest] = useState(false);
|
||||||
|
|
||||||
|
function handleBlur(event:any) {
|
||||||
|
console.log(event)
|
||||||
|
if (!event.currentTarget.contains(event.relatedTarget)) {
|
||||||
|
setTest(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<ThemeDropDown>
|
<ThemeDropDown onBlur={(event) => handleBlur(event)}>
|
||||||
<ThemeDropDownButton onClick={() => setTest(test => !test)}>{selectedTheme.themeName}</ThemeDropDownButton>
|
<ThemeDropDownButton onClick={() => setTest(test => !test)}>{selectedTheme.themeName}</ThemeDropDownButton>
|
||||||
<ThemeDropDownOptions id="themesDropdown" show={test}>
|
<ThemeDropDownOptions id="themesDropdown" show={test}>
|
||||||
{themes.map((theme) => (
|
{themes.map((theme) => (
|
||||||
|
|
Loading…
Reference in a new issue