-
Notifications
You must be signed in to change notification settings - Fork 500
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a08684
commit 2669d7c
Showing
6 changed files
with
76 additions
and
20 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React, {PropTypes} from 'react' | ||
|
||
function Icon ({glyph}) { | ||
return <span className={`icon fa fa-${glyph}`} aria-hidden='true'></span> | ||
} | ||
|
||
Icon.propTypes = { | ||
glyph: PropTypes.string.isRequired | ||
} | ||
|
||
export default Icon |
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,21 @@ | ||
import React, {PropTypes} from 'react' | ||
import Link from 'react-router' | ||
|
||
import i18n from '../utils/i18n' | ||
import Icon from './icon' | ||
|
||
function NavItem ({title, url, icon}) { | ||
return ( | ||
<Link className='link' to={url} activeClassName='active'> | ||
<Icon glyph={icon} /> {i18n.t(title)} | ||
</Link> | ||
) | ||
} | ||
|
||
NavItem.propTypes = { | ||
title: PropTypes.string.isRequired, | ||
url: PropTypes.string.isRequired, | ||
icon: PropTypes.string.isRequired | ||
} | ||
|
||
export default NavItem |
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
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
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,14 @@ | ||
import {expect} from 'chai' | ||
import React from 'react' | ||
import Test from 'legit-tests/no-dom' | ||
|
||
import Icon from '../../app/scripts/views/icon' | ||
|
||
describe('Icon', () => { | ||
it('renders the given glyph', () => { | ||
Test(<Icon glyph='list'/>) | ||
.test(function () { | ||
expect(this.instance.props.className).to.be.eql('icon fa fa-list') | ||
}) | ||
}) | ||
}) |
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,20 @@ | ||
import {expect} from 'chai' | ||
import React from 'react' | ||
import Test from 'legit-tests/no-dom' | ||
|
||
import NavItem from '../../app/scripts/views/nav-item' | ||
|
||
describe('NavItem', () => { | ||
it('renders', () => { | ||
Test(<NavItem title='List' url='/list' icon='list'/>) | ||
// .find('Link') | ||
// .test(({link}) => { | ||
// expect(link.props.to).to.be.eql('/list') | ||
// expect(link.value).to.be.eql('List') | ||
// }) | ||
.find('Icon') | ||
.test(({Icon}) => { | ||
expect(Icon.props.glyph).to.be.eql('list') | ||
}) | ||
}) | ||
}) |