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 { export class Button extends React.Component {
render () { 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') { if (type == 'link') {
return <a href={ href } className={ className } onClick={ onClick }>{ label }</a>; return <a href={ href } className={ className } onClick={ onClick }>{ label }</a>;
} }

View file

@ -33,12 +33,25 @@ export class Field extends React.Component {
} }
render() { 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; const { mount = true } = this.state;
return mount ? ( return mount ? (
<div className={ className }> <div className={ className }>
<label htmlFor={ id }>{ label }</label> <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> </div>
) : null; ) : null;
} }

View file

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