Fix drawer not closing when url change
parent
55fcec82e6
commit
9696767018
|
@ -2,6 +2,7 @@ import FocusTrap from 'focus-trap-react'
|
|||
import { ReactNode, useCallback, useEffect, useRef, useState } from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import { Trans } from 'react-i18next'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
import styled, { css } from 'styled-components'
|
||||
|
||||
import { useOnClickOutside } from '@/hooks/useOnClickOutside'
|
||||
|
@ -92,6 +93,12 @@ export const Drawer = ({
|
|||
closeDrawer()
|
||||
})
|
||||
|
||||
const location = useLocation()
|
||||
|
||||
useEffect(() => {
|
||||
closeDrawer()
|
||||
}, [closeDrawer, location])
|
||||
|
||||
return (
|
||||
<>
|
||||
{trigger({
|
||||
|
|
Loading…
Reference in New Issue