Skip to content

Instantly share code, notes, and snippets.

@markbrown4
Last active September 15, 2016 09:04
Show Gist options
  • Save markbrown4/442e75ee3074d410ab54 to your computer and use it in GitHub Desktop.
Save markbrown4/442e75ee3074d410ab54 to your computer and use it in GitHub Desktop.
if (this.props.store.submissionInProgress) {
className = styles.inProgress
} else if (this.props.store.errorOccurred) {
className = styles.error
} else if (!this.props.form.valid) {
className = styles.disabled
} else {
className = styles.normal
}
// simpler with strings additive
classes = classNames('normal', {
'in-progress': @props.store.submissionInProgress,
'error': @props.store.errorOccurred,
'disabled': !@props.form.valid
})
// Suppose you could make a wrapper for it though pretty simply, non additive
classes = moduleName(styles, 'normal', {
'inProgress': @props.store.submissionInProgress,
'error': @props.store.errorOccurred,
'disabled': !@props.form.valid
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment