mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-03 01:18:43 +02:00
1-3073: close sidebar when you click a link within it (#8763)
This change makes it so that the project status sidebar will close when you follow a link within it. We do that by using JS event bubbling and attaching a handler on the modal parent. We can listen for events and check whether the target is an anchor and, if so, close the modal.
This commit is contained in:
parent
1af204e0f0
commit
2014d367f8
@ -106,7 +106,16 @@ const CloseRow = styled('div')(({ theme }) => ({
|
|||||||
|
|
||||||
export const ProjectStatusModal = ({ open, close }: Props) => {
|
export const ProjectStatusModal = ({ open, close }: Props) => {
|
||||||
return (
|
return (
|
||||||
<DynamicSidebarModal open={open} onClose={close} label='Project status'>
|
<DynamicSidebarModal
|
||||||
|
open={open}
|
||||||
|
onClose={close}
|
||||||
|
label='Project status'
|
||||||
|
onClick={(e: React.SyntheticEvent) => {
|
||||||
|
if (e.target instanceof HTMLAnchorElement) {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
<ModalContentContainer>
|
<ModalContentContainer>
|
||||||
<HeaderRow>
|
<HeaderRow>
|
||||||
<StyledProjectStatusSvg aria-hidden='true' />
|
<StyledProjectStatusSvg aria-hidden='true' />
|
||||||
|
Loading…
Reference in New Issue
Block a user