Skip to content

Commit ed6b830

Browse files
committed
fade in load to make page load less choppy. hide sidebar when user is not onboarded
1 parent 6dc5c97 commit ed6b830

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

client/src/components/MainLayout/MainLayout.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react'
22
import { View } from 'react-native'
33
import styled from 'styled-components'
4+
import { useMeQuery } from '../../generated/graphql'
45
import Sidebar from './Sidebar'
56
import MenuIcon from './MenuIcon'
67

@@ -10,6 +11,19 @@ const Wrapper = styled(View)`
1011
height: 100%;
1112
min-height: 100vh;
1213
background: var(--light-grayish-blue);
14+
15+
@keyframes fadeIn {
16+
0% {
17+
opacity: 0;
18+
}
19+
100% {
20+
opacity: 1;
21+
}
22+
}
23+
24+
animation-name: fadeIn;
25+
animation-duration: 0.3s;
26+
animation-timing-function: ease-in;
1327
`
1428

1529
interface MainLayoutProps {
@@ -19,7 +33,10 @@ interface MainLayoutProps {
1933
export const SidebarContext = React.createContext({ sidebarOpen: false })
2034

2135
const MainLayout = ({ children }: MainLayoutProps) => {
22-
const [sidebarOpen, setSidebarOpen] = React.useState(true)
36+
const { data } = useMeQuery()
37+
38+
const [sidebarOpen, setSidebarOpen] = React.useState(!!(data && data.me && data.me.isOnboarded))
39+
2340
return (
2441
<SidebarContext.Provider value={{ sidebarOpen }}>
2542
<Wrapper>

0 commit comments

Comments
 (0)