Skip to content

Instantly share code, notes, and snippets.

@luandevpro
Created May 21, 2019 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luandevpro/07ff20e1d145a5d0ad82b31c5da9d794 to your computer and use it in GitHub Desktop.
Save luandevpro/07ff20e1d145a5d0ad82b31c5da9d794 to your computer and use it in GitHub Desktop.
import React from 'react';
import styled from 'styled-components';
const Nav = ({ display, setDisplay, style }) => (
<NavStyled>
<BackgroundStyled
onClick={() => setDisplay(!display)}
style={{
opacity: style.bgOpacity,
}}
/>
<MenuStyled style={style}>
<ul>
<li><a>Hello</a></li>
<li><a>Hello</a></li>
<li><a>Hello</a></li>
</ul>
</MenuStyled>
</NavStyled>
);
export default Nav;
const BackgroundStyled = styled.div`
background: rgba(0,0,0,0.2);
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 2;
`;
const NavStyled = styled.div`
background: rgba(0, 0, 0, 0);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
`;
const MenuStyled = styled.div`
z-index: 3;
position: absolute;
background: white;
width: 20%;
left: 0;
top: 0;
height: 100%;
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment