Skip to content

Instantly share code, notes, and snippets.

@oojr
Created May 5, 2017 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oojr/c70c29ec175b4319a0c732cbdaea24b0 to your computer and use it in GitHub Desktop.
Save oojr/c70c29ec175b4319a0c732cbdaea24b0 to your computer and use it in GitHub Desktop.
css styles example
.thumbnail {
margin: 5px,
padding: 5px,
background-color: #91969A,
border-radius: 3px,
min-width: 66px
}
.sponsored {
background-color: #F9BF3B,
}
import classNames from 'classnames'
import './style-in-css.css' // assume has the .thumbnail and .sponsored class declaration
class Post extends React.Component {
render(){
// css is seperated but still need javascript
const thumbnailClass = classNames({
'thumbnail': true,
'sponsored': this.props.post.type === 'sponsored'
});
<div>
<div className={thumbnailClass}>
</div>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment