Skip to content

Instantly share code, notes, and snippets.

@kvnam
Last active October 9, 2018 11:57
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 kvnam/23e8672e87c2b73ee18892d5f02a7699 to your computer and use it in GitHub Desktop.
Save kvnam/23e8672e87c2b73ee18892d5f02a7699 to your computer and use it in GitHub Desktop.
ReactPress Navigation.js
import React, { Component } from 'react';
import { Navbar, NavbarBrand, Nav } from 'reactstrap';
import NavigationItem from '../../components/NavigationItem/NavigationItem';
const navItems = [
{
link: '/',
linkName: 'BLOG',
isVisible: true
},
{
link: '/auth',
linkName: 'SIGN IN/SIGN UP',
isVisible: true
}
];
class Navigation extends Component{
render(){
const navList = navItems.map(item => {
return <NavigationItem key={item.link} link={item.link} linkName={item.linkName} />
});
return(
<Navbar color="inverse">
<NavbarBrand href="/">ReactPress</NavbarBrand>
<Nav className="justify-content-end">
{navList}
</Nav>
</Navbar>
);
};
};
export default Navigation;
import React from 'react';
import { NavLink } from 'react-router-dom';
import { NavItem } from 'reactstrap';
import './NavigationItem.css';
const navigationItem = props => {
return (
<React.Fragment>
<NavItem className="nav-item">
<NavLink to={props.link}>{props.linkName}</NavLink>
</NavItem>
</React.Fragment>
)
};
export default navigationItem;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment