-
-
Save velopert/7377bf0f6442800fb5e285258093bf12 to your computer and use it in GitHub Desktop.
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
import React from 'react'; | |
import { Link } from 'react-router'; | |
import './Header.css'; | |
const MenuItem = ({active, children, to}) => ( | |
<Link to={to} className={`menu-item ${active ? 'active': ''}`}> | |
{children} | |
</Link> | |
); | |
const Header = (props, context) => { | |
const { router } = context; | |
return ( | |
<div> | |
<div className="logo"> | |
velopert | |
</div> | |
<div className="menu"> | |
<MenuItem to={'/'} active={router.isActive('/', true)}>홈</MenuItem> | |
<MenuItem to={'/about'} active={router.isActive('/about')}>소개</MenuItem> | |
<MenuItem to={'/post'} active={router.isActive('/post')}>포스트</MenuItem> | |
</div> | |
</div> | |
); | |
}; | |
Header.contextTypes = { | |
router: React.PropTypes.object | |
} | |
export default Header; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment