accounts-frontend/src/components/ui/form.scss

273 lines
4.8 KiB
SCSS
Raw Normal View History

@import '~components/ui/colors.scss';
@import '~components/ui/fonts.scss';
@mixin form-transition() {
// Анимация фона должна быть быстрее анимации рамки, т.к. визуально фон заполняется медленнее
transition: border-color .25s,
background-color .20s;
}
/**
* Input
*/
2016-01-09 19:45:03 +05:30
@mixin input-theme($themeName, $color) {
.#{$themeName}TextField {
composes: textField;
&:focus {
border-color: $color;
~ .textFieldIcon {
2016-01-09 19:45:03 +05:30
background: $color;
border-color: $color;
}
&.lightTextField {
color: $color;
}
2016-01-09 19:45:03 +05:30
}
}
}
.formRow {
position: relative;
height: 50px;
max-width: 100%;
margin: 10px 0;
}
.formIconRow {
composes: formRow;
.textField {
padding-left: 60px;
}
}
.textField {
box-sizing: border-box;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 50px;
width: 100%;
border: 2px solid;
font-size: 18px;
color: #aaa;
font-family: $font-family-title;
padding: 0 10px;
transition: border-color .25s;
&::placeholder {
opacity: 1;
color: #444;
}
&:hover {
&,
~ .textFieldIcon {
border-color: #aaa;
}
}
&:focus {
color: #fff;
outline: none;
~ .textFieldIcon {
color: #fff;
}
}
}
.darkTextField {
background: $black;
border-color: lighter($black);
}
.lightTextField {
background: #fff;
border-color: #dcd8cd;
}
.textFieldIcon {
box-sizing: border-box;
position: absolute;
left: 0;
top: 0;
height: 50px;
width: 50px;
line-height: 46px;
text-align: center;
border: 2px solid lighter($black);
color: #444;
cursor: default;
@include form-transition();
}
2016-04-17 14:51:37 +05:30
.textFieldLabel {
font-family: $font-family-title;
color: #666;
font-size: 18px;
}
2016-01-09 19:45:03 +05:30
@include input-theme('green', $green);
@include input-theme('blue', $blue);
@include input-theme('red', $red);
@include input-theme('darkBlue', $dark_blue);
@include input-theme('lightViolet', $light_violet);
2016-01-09 19:45:03 +05:30
/**
* Checkbox
*/
2016-01-09 19:45:03 +05:30
@mixin checkbox-theme($themeName, $color) {
.#{$themeName}CheckboxRow {
composes: checkboxRow;
.checkboxContainer {
&:hover {
.checkbox {
border-color: $color;
}
}
}
.checkboxInput {
&:checked {
+ .checkbox {
background: $color;
border-color: $color;
}
}
}
}
}
.checkboxRow {
height: 22px;
margin-top: 15px;
}
.checkboxContainer {
display: inline-block;
position: relative;
padding-left: 27px;
font-family: $font-family-title;
font-size: 16px;
line-height: 24px;
color: #fff;
cursor: pointer;
}
.checkboxPosition {
position: absolute;
box-sizing: border-box;
left: 0;
top: 0;
margin: 0;
width: 22px;
height: 22px;
}
.checkboxInput {
composes: checkboxPosition;
opacity: 0;
&:checked {
+ .checkbox {
&:before {
opacity: 1;
}
}
}
}
.checkbox {
composes: checkboxPosition;
composes: checkmark from './icons.scss';
border: 2px #dcd8cd solid;
font-size: 10px;
line-height: 18px;
@include form-transition();
&:before {
opacity: 0;
transition: opacity 0.3s;
}
}
2016-01-09 19:45:03 +05:30
@include checkbox-theme('green', $green);
@include checkbox-theme('blue', $blue);
@include checkbox-theme('red', $red);
/**
* Form validation
*/
.formTouched .textField:invalid {
box-shadow: none;
&,
~ .textFieldIcon {
border-color: #3e2727;
}
~ .textFieldIcon {
color: #3e2727;
}
&:hover {
&,
~ .textFieldIcon {
border-color: $red;
}
}
&:focus {
border-color: $red;
~ .textFieldIcon {
background: $red;
border-color: $red;
color: #fff;
}
}
}
.formTouched .checkboxInput:invalid {
~ .checkbox {
border-color: $red;
}
}
.isFormLoading {
// TODO: надо бы разнести from и input на отдельные модули,
// так как в текущем контексте isLoading немного не логичен,
// пришлось юзать isFormLoading
* {
pointer-events: none;
}
[type="submit"] {
background: url('images/loader_button.gif') #95a5a6 center center;
cursor: default;
color: #fff;
transition: 0.25s;
outline: none;
}
}