ducky/web
ducky/web/src/pages/login.jsx
Update our ValidationError component to accept arrays. Allow our ValidationError component to match an array of fields, headers, or params. This is for components that may address multiple inputs (e.g., month/year inputs) but also lays the ground work for inverse-matching. Ideally, inverse-matching and matching ValidationErrors should mirror each other, logically, so the syntax is identical. But we also should have the common use case easily supported, so if you use field instead of fields (or header/headers, param/params) we'll automatically turn that into an array.
1 import app from 'ampersand-app'
2 import React from 'react'
3 import localLinks from 'local-links'
4 import LaddaButton from 'react-ladda'
5 import LaddaCSS from '../../node_modules/ladda/dist/ladda.min.css'
6 import HeroUnit from '../components/hero'
7 import onboardingStyles from '../styles/onboarding.scss'
9 export default React.createClass({
10 displayName: 'LoginPage',
12 getInitialState () {
13 return {active: false, progress: 0}
14 },
16 toggle () {
17 this.setState({active: !this.state.active})
18 },
20 onBackClick (event) {
21 event.preventDefault()
22 window.history.back()
23 },
25 render () {
26 return (
27 <div className='container'>
28 <HeroUnit title='Welcome Back'>We missed you.</HeroUnit>
29 <article className='onboarding login'>
30 <form>
31 <div>
32 <label htmlFor='emailLoginInput'>Email</label>
33 <input id='emailLoginInput' type='email'/>
35 <label htmlFor='passwordLoginInput'>Passphrase</label>
36 <input id='passwordLoginInput' type='password'/>
38 </div>
39 </form>
40 <div className='actionbuttons'>
41 <button onClick={this.onBackClick}>Back</button>
42 <LaddaButton style='expand-right' active={this.state.active} progress={this.state.progress}>
43 <button onClick={this.toggle} className='primary'>Login</button>
44 </LaddaButton>
45 </div>
46 </article>
47 </div>
48 )
49 }
50 })