mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
fix: event timeline should unmount when hidden and be closed by default (#8294)
Fixes 2 bugs: - The initial state of the event timeline should have `open: false`, not `true` - Closed by default, unless opened - The event timeline should unmount when hidden - It should not emit requests when closed
This commit is contained in:
parent
147984f9d5
commit
81840ed574
@ -64,7 +64,7 @@ type EventTimelineState = {
|
||||
};
|
||||
|
||||
const defaultState: EventTimelineState = {
|
||||
open: true,
|
||||
open: false,
|
||||
timeSpan: timeSpanOptions[0],
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Box } from '@mui/material';
|
||||
import { Box, styled } from '@mui/material';
|
||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||
import { EventTimeline } from 'component/events/EventTimeline/EventTimeline';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
@ -6,6 +7,12 @@ interface IMainLayoutEventTimelineProps {
|
||||
open: boolean;
|
||||
}
|
||||
|
||||
const StyledEventTimelineWrapper = styled(Box)(({ theme }) => ({
|
||||
backgroundColor: theme.palette.background.paper,
|
||||
height: '105px',
|
||||
overflow: 'hidden',
|
||||
}));
|
||||
|
||||
export const MainLayoutEventTimeline = ({
|
||||
open,
|
||||
}: IMainLayoutEventTimelineProps) => {
|
||||
@ -16,9 +23,8 @@ export const MainLayoutEventTimeline = ({
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Box
|
||||
<StyledEventTimelineWrapper
|
||||
sx={{
|
||||
overflow: 'hidden',
|
||||
transition: isInitialLoad
|
||||
? 'none'
|
||||
: 'max-height 0.3s ease-in-out',
|
||||
@ -31,8 +37,11 @@ export const MainLayoutEventTimeline = ({
|
||||
backgroundColor: theme.palette.background.paper,
|
||||
})}
|
||||
>
|
||||
<EventTimeline />
|
||||
<ConditionallyRender
|
||||
condition={open}
|
||||
show={<EventTimeline />}
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
</StyledEventTimelineWrapper>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user