Skip to content

Commit

Permalink
feat(project): add layout component
Browse files Browse the repository at this point in the history
  • Loading branch information
RCVZ committed Apr 29, 2021
1 parent 50369b1 commit c9d813b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/Layout/Layout.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@use '../../styles/variables';
@use '../../styles/theme';

.Layout {
width: 100vw;
height: 100vh;
}
13 changes: 13 additions & 0 deletions src/components/Layout/Layout.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';

import { render } from '../../testUtils';

import Layout from './Layout';

describe('<Layout />', () => {
test('renders layout', () => {
const { container } = render(<Layout />);

expect(container).toMatchSnapshot();
});
});
27 changes: 27 additions & 0 deletions src/components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React, { ReactNode, FC, useState } from 'react';

import Header from '../Header/Header';
import SideBar from '../SideBar/SideBar';

import styles from './Layout.module.scss';

type LayoutProps = {
children?: ReactNode;
};

const Layout: FC<LayoutProps> = ({ children }) => {
const [sideBarOpen, toggleSideBar] = useState(false);

return (
<div className={styles.layout}>
<Header openSideBar={() => toggleSideBar(true)} />
<SideBar
sideBarOpen={sideBarOpen}
closeSideBar={() => toggleSideBar(false)}
/>
{children}
</div>
);
};

export default Layout;

0 comments on commit c9d813b

Please sign in to comment.