Created
May 19, 2017 07:19
-
-
Save torryt/6ef6e85e4f5b404d0c5ceca62afdb00e 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
getExplanationSection() { | |
const explanation = this.props.explanation; | |
if (explanation !== undefined) { | |
return ( | |
<div onClick={() => this.setState({ expanded: !this.state.expanded })}> | |
<section className={'nokkeltall-explanation'}> | |
{explanation} | |
</section> | |
</div> | |
); | |
} | |
} | |
render() { | |
const { value, title, subtitle } = this.props; | |
const expanded = this.state.expanded; | |
return ( | |
<article className='nokkeltall'> | |
<section className='nokkeltall-content'> | |
<div className='nokkeltall-number'>{nokkeltallValueFormat(value)}</div> | |
<h3 className='nokkeltall-subtitle'>{subtitle}</h3> | |
<h2 className='nokkeltall-title'>{title}</h2> | |
</section> | |
{this.getExplanationSection()} | |
<button className='nokkeltall-expand-icon'> | |
{expanded | |
? <i className='icon-up-open-big'></i> | |
: <i className='icon-down-open-big'></i> | |
} | |
</button> | |
</article>); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment