Skip to content

Instantly share code, notes, and snippets.

@luandevpro luandevpro/Nav.js
Created May 21, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.