Форма регистрации

This commit is contained in:
SleepWalker 2016-01-09 16:15:03 +02:00
parent a3cf38e458
commit 2018a6778e
4 changed files with 61 additions and 28 deletions

View File

@ -149,15 +149,15 @@ export default class SignIn extends Component {
<Panel title={<Message {...messages.signUpTitle} />}> <Panel title={<Message {...messages.signUpTitle} />}>
<PanelBody> <PanelBody>
{/* TODO: E-mail i18n*/} {/* TODO: E-mail i18n*/}
<Input icon="user" type="text" placeholder="Your nickname" /> <Input icon="user" color="blue" type="text" placeholder="Your nickname" />
{/* TODO: E-mail i18n*/} {/* TODO: E-mail i18n*/}
<Input icon="envelope" type="email" placeholder="Your E-mail" /> <Input icon="envelope" color="blue" type="email" placeholder="Your E-mail" />
{/* TODO: Account password i18n*/} {/* TODO: Account password i18n*/}
<Input icon="key" type="password" placeholder="Account password" /> <Input icon="key" color="blue" type="password" placeholder="Account password" />
{/* TODO: Account password i18n*/} {/* TODO: Account password i18n*/}
<Input icon="key" type="password" placeholder="Repeat password" /> <Input icon="key" color="blue" type="password" placeholder="Repeat password" />
<Checkbox label={ <Checkbox color="blue" label={
<Message {...messages.acceptRules} values={{ <Message {...messages.acceptRules} values={{
link: ( link: (
<a href="#"> <a href="#">
@ -194,7 +194,7 @@ export default class SignIn extends Component {
</div> </div>
<div className={styles.formRow}> <div className={styles.formRow}>
{/* TODO: E-mail i18n*/} {/* TODO: E-mail i18n*/}
<Input type="email" placeholder="Enter the code from E-mail here" /> <Input type="email" color="blue" placeholder="Enter the code from E-mail here" />
</div> </div>
</PanelBody> </PanelBody>
<PanelFooter> <PanelFooter>

View File

@ -6,23 +6,24 @@ import icons from './icons.scss';
import styles from './form.scss'; import styles from './form.scss';
export function Input(props) { export function Input(props) {
var { icon, color = 'green' } = props;
props = { props = {
type: 'text', type: 'text',
...props ...props
}; };
var baseClass = styles.formRow; var baseClass = styles.formRow;
var icon; if (icon) {
if (props.icon) {
baseClass = styles.formIconRow; baseClass = styles.formIconRow;
icon = ( icon = (
<div className={classNames(styles.formFieldIcon, icons[props.icon])} /> <div className={classNames(styles.formFieldIcon, icons[icon])} />
); );
} }
return ( return (
<div className={baseClass}> <div className={baseClass}>
<input className={styles.textField} {...props} /> <input className={styles[`${color}TextField`]} {...props} />
{icon} {icon}
</div> </div>
); );
@ -32,10 +33,10 @@ export class Checkbox extends Component {
displayName = 'Checkbox'; displayName = 'Checkbox';
render() { render() {
var { label } = this.props; var { label, color = 'green' } = this.props;
return ( return (
<div className={styles.checkboxRow}> <div className={styles[`${color}CheckboxRow`]}>
<label className={styles.checkboxContainer}> <label className={styles.checkboxContainer}>
<input className={styles.checkboxInput} type="checkbox" /> <input className={styles.checkboxInput} type="checkbox" />
<div className={styles.checkbox} /> <div className={styles.checkbox} />

View File

@ -1,8 +1,8 @@
@import './colors.scss'; @import './colors.scss';
@import './fonts.scss'; @import './fonts.scss';
@mixin button-color($colorName, $backgroundColor, $textColor : $defaultButtonTextColor) { @mixin button-theme($themeName, $backgroundColor, $textColor : $defaultButtonTextColor) {
.#{$colorName} { .#{$themeName} {
composes: button; composes: button;
@if ($textColor != $defaultButtonTextColor) { @if ($textColor != $defaultButtonTextColor) {
@ -56,5 +56,5 @@
} }
} }
@include button-color('blue', $blue); @include button-theme('blue', $blue);
@include button-color('green', $green); @include button-theme('green', $green);

View File

@ -10,6 +10,21 @@
/** /**
* Input * Input
*/ */
@mixin input-theme($themeName, $color) {
.#{$themeName}TextField {
composes: textField;
&:focus {
border-color: $color;
~ .formFieldIcon {
background: $color;
border-color: $color;
}
}
}
}
.formRow { .formRow {
position: relative; position: relative;
height: 50px; height: 50px;
@ -59,13 +74,10 @@
} }
&:focus { &:focus {
border-color: $green;
color: #fff; color: #fff;
outline: none; outline: none;
~ .formFieldIcon { ~ .formFieldIcon {
background: $green;
border-color: $green;
color: #fff; color: #fff;
} }
} }
@ -87,10 +99,36 @@
@include form-transition(); @include form-transition();
} }
@include input-theme('green', $green);
@include input-theme('blue', $blue);
/** /**
* Checkbox * Checkbox
*/ */
@mixin checkbox-theme($themeName, $color) {
.#{$themeName}CheckboxRow {
composes: checkboxRow;
.checkboxContainer {
&:hover {
.checkbox {
border-color: $color;
}
}
}
.checkboxInput {
&:checked {
+ .checkbox {
background: $color;
border-color: $color;
}
}
}
}
}
.checkboxRow { .checkboxRow {
height: 22px; height: 22px;
margin-top: 15px; margin-top: 15px;
@ -107,12 +145,6 @@
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
&:hover {
.checkbox {
border-color: $green;
}
}
} }
.checkboxPosition { .checkboxPosition {
@ -132,9 +164,6 @@
&:checked { &:checked {
+ .checkbox { + .checkbox {
background: $green;
border-color: $green;
&:before { &:before {
opacity: 1; opacity: 1;
} }
@ -158,3 +187,6 @@
transition: opacity 0.3s; transition: opacity 0.3s;
} }
} }
@include checkbox-theme('green', $green);
@include checkbox-theme('blue', $blue);