Improved code style.

This commit is contained in:
Tim Brandin 2016-04-02 22:49:12 +02:00
parent 2691611f34
commit 81ce433149
3 changed files with 25 additions and 4 deletions

View file

@ -3,7 +3,14 @@ import { Accounts } from 'meteor/accounts-base';
export class Button extends React.Component {
render () {
const { label, href = null, type, disabled = false, className, onClick } = this.props;
const {
label,
href = null,
type,
disabled = false,
className,
onClick
} = this.props;
if (type == 'link') {
return <a href={ href } className={ className } onClick={ onClick }>{ label }</a>;
}

View file

@ -33,12 +33,25 @@ export class Field extends React.Component {
}
render() {
const { id, hint, label, type = 'text', onChange, className = "field", defaultValue = "" } = this.props;
const {
id,
hint,
label,
type = 'text',
onChange,
required = false,
className = "field",
defaultValue = ""
} = this.props;
const { mount = true } = this.state;
return mount ? (
<div className={ className }>
<label htmlFor={ id }>{ label }</label>
<input id={ id } type={ type } onChange={ onChange } placeholder={ hint } defaultValue={ defaultValue } />
<input id={ id } 
type={ type }
onChange={ onChange }
placeholder={ hint }
defaultValue={ defaultValue } />
</div>
) : null;
}

View file

@ -5,7 +5,8 @@ export class FormMessage extends React.Component {
render () {
let { message, type, className = "message", style = {} } = this.props;
return message ? (
<div style={ style } className={[ className, type ].join(' ')}>{ message }</div>
<div style={ style } 
className={[ className, type ].join(' ')}>{ message }</div>
) : null;
}
}