Skip to content

Commit

Permalink
fix: close language selector after click
Browse files Browse the repository at this point in the history
  • Loading branch information
Pvcunha committed Jan 2, 2024
1 parent 3285d79 commit 0166fde
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/components/locale-switcher-footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default function LocaleSwitcherFooter() {
router.push(router.pathname, router.asPath, { locale })
disclosure.hide()
}

const disclosure = useDisclosureState({ visible: false })
const Option = ({ screen, option, onClick, active }: OptionProps) => {
const variant = `localeSwitcher.${screen}.option`
Expand Down Expand Up @@ -60,23 +61,23 @@ export default function LocaleSwitcherFooter() {
direction={disclosure.visible ? 'up' : 'down'}
size={30}
/>
</Disclosure>

<DisclosureContent {...disclosure}>
<Box sx={styles.optionContainer}>
<DisclosureContent {...disclosure}>
{options.map((option) => (
<Option
key={option.label}
option={option}
screen="large"
onClick={() => {
handleOptionClick(option.value)
}}
active={option.value === router.locale}
/>
))}
</DisclosureContent>
{options.map((option) => (
<Option
key={option.label}
option={option}
screen="large"
onClick={() => {
handleOptionClick(option.value)
}}
active={option.value === router.locale}
/>
))}
</Box>
</Disclosure>
</DisclosureContent>
</Box>
)
}

0 comments on commit 0166fde

Please sign in to comment.