mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +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 = {
|
const defaultState: EventTimelineState = {
|
||||||
open: true,
|
open: false,
|
||||||
timeSpan: timeSpanOptions[0],
|
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 { EventTimeline } from 'component/events/EventTimeline/EventTimeline';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
@ -6,6 +7,12 @@ interface IMainLayoutEventTimelineProps {
|
|||||||
open: boolean;
|
open: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const StyledEventTimelineWrapper = styled(Box)(({ theme }) => ({
|
||||||
|
backgroundColor: theme.palette.background.paper,
|
||||||
|
height: '105px',
|
||||||
|
overflow: 'hidden',
|
||||||
|
}));
|
||||||
|
|
||||||
export const MainLayoutEventTimeline = ({
|
export const MainLayoutEventTimeline = ({
|
||||||
open,
|
open,
|
||||||
}: IMainLayoutEventTimelineProps) => {
|
}: IMainLayoutEventTimelineProps) => {
|
||||||
@ -16,9 +23,8 @@ export const MainLayoutEventTimeline = ({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<StyledEventTimelineWrapper
|
||||||
sx={{
|
sx={{
|
||||||
overflow: 'hidden',
|
|
||||||
transition: isInitialLoad
|
transition: isInitialLoad
|
||||||
? 'none'
|
? 'none'
|
||||||
: 'max-height 0.3s ease-in-out',
|
: 'max-height 0.3s ease-in-out',
|
||||||
@ -31,8 +37,11 @@ export const MainLayoutEventTimeline = ({
|
|||||||
backgroundColor: theme.palette.background.paper,
|
backgroundColor: theme.palette.background.paper,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<EventTimeline />
|
<ConditionallyRender
|
||||||
</Box>
|
condition={open}
|
||||||
|
show={<EventTimeline />}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
</StyledEventTimelineWrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user