-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Reusable <NavigationItem/> inside <NavigationItems/>
- Loading branch information
Showing
4 changed files
with
68 additions
and
1 deletion.
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
40 changes: 40 additions & 0 deletions
40
src/components/Navigation/NavigationItems/NavigationItem/NavigationItem.component.jsx
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,40 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
const NavigationItem = styled.div` | ||
margin: 0; | ||
box-sizing: border-box; | ||
display: flex; | ||
height: 100%; | ||
align-items: center; | ||
& a { | ||
color: white; | ||
text-decoration: none; | ||
height: 100%; | ||
padding: 16px 10px; | ||
border-bottom: 4px solid transparent; | ||
box-sizing: border-box; | ||
display: block; | ||
&:hover, | ||
&:active, | ||
&.active { | ||
background-color: #8F5C2C; | ||
border-bottom: 4px solid #40A4C8; | ||
} | ||
} | ||
`; | ||
|
||
const navigationItem = (props) => ( | ||
<NavigationItem> | ||
<a | ||
href={props.link} | ||
className={props.active ? 'active' : null} | ||
> | ||
{props.children} | ||
</a> | ||
</NavigationItem> | ||
); | ||
|
||
export default navigationItem; |
25 changes: 25 additions & 0 deletions
25
src/components/Navigation/NavigationItems/NavigationItems.component.jsx
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,25 @@ | ||
// LIBRARY IMPORTS | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
// CUSTOM COMPONENT | ||
import NavigationItem from './NavigationItem/NavigationItem.component'; | ||
|
||
// STYLED UL | ||
const NavigationItems = styled.ul` | ||
margin: 0; | ||
padding: 0; | ||
list-style: none; | ||
display: flex; | ||
align-items: center; | ||
height: 100%; | ||
`; | ||
|
||
const navigationItems = () => ( | ||
<NavigationItems> | ||
<NavigationItem link="/" active>Burger Builder</NavigationItem> | ||
<NavigationItem link="/">Checkout</NavigationItem> | ||
</NavigationItems> | ||
); | ||
|
||
export default navigationItems; |
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