mirror of
https://github.com/vale981/accounts-ui
synced 2025-03-05 09:51:40 -05:00
Improved code style.
This commit is contained in:
parent
2691611f34
commit
81ce433149
3 changed files with 25 additions and 4 deletions
|
@ -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>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue