Now the sidebar closes when the cookie banner is toggled

This commit is contained in:
apane 2019-12-04 09:19:07 -03:00
parent d2a7ff94cb
commit 2e1acb5758
2 changed files with 13 additions and 3 deletions

View File

@ -21,9 +21,19 @@ const useStyles = makeStyles({
}, },
}) })
const LegalLinks = () => { type Props = {
toggleSidebar: Function,
}
const LegalLinks = (props: Props) => {
const classes = useStyles() const classes = useStyles()
const dispatch = useDispatch() const dispatch = useDispatch()
const openCookiesHandler = () => {
dispatch(openCookieBanner(true))
props.toggleSidebar()
}
return ( return (
<Block className={classes.container} justify="space-around"> <Block className={classes.container} justify="space-around">
<Link className={classes.link} to="https://safe.gnosis.io/terms" target="_blank"> <Link className={classes.link} to="https://safe.gnosis.io/terms" target="_blank">
@ -38,7 +48,7 @@ const LegalLinks = () => {
<Link className={classes.link} to="https://safe.gnosis.io/imprint" target="_blank"> <Link className={classes.link} to="https://safe.gnosis.io/imprint" target="_blank">
Imprint Imprint
</Link> </Link>
<GnoButtonLink className={classes.buttonLink} onClick={() => dispatch(openCookieBanner(true))}> <GnoButtonLink className={classes.buttonLink} onClick={openCookiesHandler}>
Cookies Cookies
</GnoButtonLink> </GnoButtonLink>
</Block> </Block>

View File

@ -131,7 +131,7 @@ const Sidebar = ({
setDefaultSafe={setDefaultSafeAction} setDefaultSafe={setDefaultSafeAction}
defaultSafe={defaultSafe} defaultSafe={defaultSafe}
/> />
<LegalLinks /> <LegalLinks toggleSidebar={toggleSidebar} />
</Drawer> </Drawer>
</ClickAwayListener> </ClickAwayListener>
{children} {children}