Skip to content

Instantly share code, notes, and snippets.

@johno
Last active August 26, 2016 18:00
Show Gist options
  • Save johno/3a3a406324c480b4d1718bd2d38493e8 to your computer and use it in GitHub Desktop.
Save johno/3a3a406324c480b4d1718bd2d38493e8 to your computer and use it in GitHub Desktop.
Using dynamic classnames with Tachyons
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} />
}
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