Last active
July 6, 2017 01:59
-
-
Save jhyland87/4c75dde6919febda72ea146835ccfccb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class PageContent extends Component { | |
render() { | |
return ( | |
<div id="content" className="content"> | |
<BreadCrumbs align="left"> | |
<BreadCrumbs.Crumb href="#foo">foo</BreadCrumbs.Crumb> | |
<BreadCrumbs.Crumb href="#bar">bar</BreadCrumbs.Crumb> | |
<BreadCrumbs.Crumb href="#baz">baz</BreadCrumbs.Crumb> | |
</BreadCrumbs> | |
</div> | |
); | |
} | |
} | |
class BreadCrumbs extends Component { | |
static Crumb (props){ | |
return ( <a href={props.href}>{_.upperFirst(props.children)}</a> ) | |
} | |
render(){ | |
var ch = this.props.children | |
return ( | |
<ol className={ 'breadcrumb pull-' + _.defaultTo( this.props.pull, 'right' ) }> | |
{ch.map(function(child, idx){ | |
return ( ch.length === idx+1 ) | |
? <li className="active">{ _.upperFirst( child.props.children ) }</li> | |
: <li>{child}</li> | |
})} | |
</ol> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment