Created
July 5, 2016 04:26
-
-
Save wyqydsyq/69b1d4afd8947cc5685a86afad06c901 to your computer and use it in GitHub Desktop.
css modules classname
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
import styles from './styles.less'; | |
const render = (state) => h('form', {props: {className: [styles.form, styles.formHorizontal].join(' ')}}, [ | |
h('fieldset', [ | |
// show alerts if there's any | |
state.alerts.length ? h('div.alerts', | |
state.alerts.map(alert => h(`div.alert.${alert.className}`, alert.text)) | |
) : '', | |
h(`legend.${styles.legend}`, 'Login'), | |
h(`div.${styles.field}`, [ | |
h(`label`, 'Email'), | |
h(`div`, [ | |
h('input#email', {props: {type: 'email', name: 'email', className: styles.control}}) | |
]) | |
]), | |
h(`div.${styles.field}`, [ | |
h(`label`, 'Password'), | |
h(`div`, [ | |
h('input#password', {props: {type: 'password', name: 'password', className: styles.control}}) | |
]) | |
]), | |
h(`div`, [ | |
h(`button.${styles.submit}.${styles.block}`, {props: {type: 'button', disabled: state.submitting}}, [ | |
state.submitting | |
? h(`i`, {props: {className: [ | |
styles.fa, | |
styles.faSpinner, | |
styles.faSpin | |
].join(' ')}}) | |
: h(`i`, {props: {className: [ | |
styles.fa, | |
styles.faSignIn | |
].join(' ')}}), | |
state.submitting ? ' Logging in...' : ' Login' | |
]) | |
]) | |
]) | |
]); | |
const LoginForm = (state) => {DOM: render(state)}; | |
exports default LoginForm; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment