forked from Immortalin/onefraction
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a2c26c
commit 655569d
Showing
7 changed files
with
101 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as React from 'react' | ||
import { View } from 'react-native' | ||
import styled from 'styled-components' | ||
import Sidebar from './Sidebar' | ||
import MenuIcon from './MenuIcon' | ||
|
||
const Wrapper = styled(View)` | ||
flex: 1; | ||
flex-direction: row; | ||
height: 100%; | ||
min-height: 100vh; | ||
background: var(--light-grayish-blue); | ||
` | ||
|
||
interface MainLayoutProps { | ||
children: JSX.Element | ||
} | ||
|
||
export const SidebarContext = React.createContext({ sidebarOpen: false }) | ||
|
||
const MainLayout = ({ children }: MainLayoutProps) => { | ||
const [sidebarOpen, setSidebarOpen] = React.useState(true) | ||
return ( | ||
<SidebarContext.Provider value={{ sidebarOpen }}> | ||
<Wrapper> | ||
<Sidebar open={sidebarOpen} /> | ||
<MenuIcon onPress={() => setSidebarOpen(!sidebarOpen)} /> | ||
{children} | ||
</Wrapper> | ||
</SidebarContext.Provider> | ||
) | ||
} | ||
|
||
export default MainLayout |
2 changes: 1 addition & 1 deletion
2
.../src/screens/Home/components/MenuIcon.tsx → ...nt/src/components/MainLayout/MenuIcon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
...t/src/screens/Home/components/Sidebar.tsx → client/src/components/MainLayout/Sidebar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...c/screens/Home/components/SidebarItem.tsx → ...src/components/MainLayout/SidebarItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default } from './MainLayout' | ||
export * from './MainLayout' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters