use virtual-dom to implement functionality for invite form

This commit is contained in:
Riku Rouvila
2015-01-21 23:30:33 +02:00
parent a7bfb8e591
commit 92d7790b4a
5 changed files with 115 additions and 15 deletions

View File

@@ -0,0 +1,40 @@
'use strict';
var {h} = require('virtual-dom');
var classList = require('../util/classList');
function render(props, state) {
var emailInput = h('input', {
className: classList({
'input': true,
'has-success': state.submitted,
'has-error': state.error
}),
type: 'text',
name: 'email',
placeholder: 'Email',
value: state.email,
onkeydown: props.onChange
});
var submitButton = h('button', {
className: 'btn btn__submit',
type: 'submit',
title: 'Lähetä',
disabled: state.error || state.submitted
}, '⏎');
return h('form', {
className: classList({
'invite-form': true,
'has-success': state.submitted,
'has-error': state.error
}),
onsubmit: props.onSubmit
}, [
emailInput,
submitButton
]);
}
module.exports = render;