Last active
August 26, 2016 18:00
-
-
Save johno/3a3a406324c480b4d1718bd2d38493e8 to your computer and use it in GitHub Desktop.
Using dynamic classnames with Tachyons
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
import React from 'react' | |
import classNames from 'classnames' | |
export default ({ isLoading, className, ...otherProps }) => { | |
const cx = classNames(className, { 'bg-green': !isLoading }, { 'bg-yellow': isLoading }) | |
return <div className={cx} {...otherProps} /> | |
} |
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
import React from 'react' | |
import classNames from 'classnames' | |
export default ({ isLoading, message, ...otherProps }) => { | |
const cx = classNames('tc p2', { 'bg-green': !isLoading }, { 'bg-yellow': isLoading }) | |
return ( | |
<div className={cx} {...otherProps}> | |
{message} | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment