fix hide anim firing on page load

pull/393/head
slowbackspace 5 years ago
parent 7bc375f0b9
commit bbde7481e4

@ -114,7 +114,7 @@ const A = styled.a`
type Props = { type Props = {
sidebarEnabled?: boolean, sidebarEnabled?: boolean,
sidebarOpened?: boolean, sidebarOpened?: ?boolean,
toggleSidebar?: toggleSidebarType, toggleSidebar?: toggleSidebarType,
}; };

@ -15,7 +15,7 @@ type State = {
online: boolean; online: boolean;
dropdownOpened: boolean; dropdownOpened: boolean;
showBetaDisclaimer: boolean; showBetaDisclaimer: boolean;
showSidebar: boolean; showSidebar: ?boolean;
initialParams: ?RouterLocationState; initialParams: ?RouterLocationState;
initialPathname: ?string; initialPathname: ?string;
firstLocationChange: boolean; firstLocationChange: boolean;
@ -29,7 +29,7 @@ const initialState: State = {
dropdownOpened: false, dropdownOpened: false,
firstLocationChange: true, firstLocationChange: true,
showBetaDisclaimer: false, showBetaDisclaimer: false,
showSidebar: false, showSidebar: null,
initialParams: null, initialParams: null,
initialPathname: null, initialPathname: null,
disconnectRequest: null, disconnectRequest: null,

@ -9,7 +9,7 @@ import { SLIDE_RIGHT, SLIDE_LEFT } from 'config/animations';
type Props = { type Props = {
children?: React.Node, children?: React.Node,
isOpen: boolean, isOpen: ?boolean,
} }
type State = { type State = {
@ -32,6 +32,9 @@ const AbsoluteWrapper = styled.aside`
height: calc(100vh - 52px); height: calc(100vh - 52px);
z-index: 200; z-index: 200;
top: 52px; top: 52px;
/* Prevents firing SLIDE_LEFT anim on page load. */
/* isOpen is null until user clicks on menu toggler */
display: ${props => (props.isOpen === null ? 'none' : 'block')};
animation: ${props => (props.isOpen ? SLIDE_RIGHT : SLIDE_LEFT)} 0.25s cubic-bezier(0.17, 0.04, 0.03, 0.94) forwards; animation: ${props => (props.isOpen ? SLIDE_RIGHT : SLIDE_LEFT)} 0.25s cubic-bezier(0.17, 0.04, 0.03, 0.94) forwards;
} }

Loading…
Cancel
Save