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

346 lines
6.0 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 {
margin: 10px 0;
}
.formIconRow {
composes: formRow;
.textField {
padding-left: 60px;
}
}
.textFieldContainer {
position: relative;
height: 50px;
max-width: 100%;
}
.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;
&:hover {
&,
~ .textFieldIcon {
border-color: #aaa;
}
}
&:focus {
color: #fff;
outline: none;
~ .textFieldIcon {
color: #fff;
}
}
}
.textFieldIcon {
box-sizing: border-box;
position: absolute;
left: 0;
top: 0;
height: 50px;
width: 50px;
line-height: 46px;
text-align: center;
border: 2px solid;
color: #444;
cursor: default;
@include form-transition();
}
.darkTextField {
background: $black;
&::placeholder {
opacity: 1;
color: #444;
}
&,
~ .textFieldIcon {
border-color: lighter($black);
}
}
.lightTextField {
background: #fff;
&::placeholder {
opacity: 1;
color: #aaa;
}
&,
~ .textFieldIcon {
border-color: #dcd8cd;
}
}
2016-04-17 14:51:37 +05:30
.textFieldLabel {
margin: 10px 0;
display: block;
2016-04-17 14:51:37 +05:30
font-family: $font-family-title;
color: #666;
font-size: 18px;
}
.fieldError {
color: $red;
font-size: 12px;
margin: 3px 0;
a {
border-bottom: 1px dotted rgba($red, 0.75);
text-decoration: none;
transition: .25s;
color: $red;
&:hover {
border-bottom-color: transparent;
}
}
}
2016-05-22 22:55:38 +05:30
.textAreaContainer {
height: auto;
}
.textArea {
height: 150px;
padding: 5px 10px;
resize: vertical;
position: relative;
}
.textFieldCenter {
text-align: center;
}
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-05-02 23:06:05 +05:30
@include input-theme('violet', $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;
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;
2016-05-02 12:45:42 +05:30
composes: checkmark from 'components/ui/icons.scss';
border: 2px #dcd8cd solid;
font-size: 10px;
line-height: 18px;
text-align: center;
color: #fff;
@include form-transition();
&:before {
opacity: 0;
transition: opacity 0.3s;
}
}
2016-01-09 19:45:03 +05:30
.lightCheckboxRow {
.checkboxContainer {
color: #666;
}
}
.darkCheckboxRow {
.checkboxContainer {
color: #fff;
}
}
2016-01-09 19:45:03 +05:30
@include checkbox-theme('green', $green);
@include checkbox-theme('blue', $blue);
@include checkbox-theme('red', $red);
.isFormLoading {
// TODO: надо бы разнести from и input на отдельные модули,
// так как в текущем контексте isLoading немного не логичен,
// пришлось юзать isFormLoading
* {
pointer-events: none;
}
[type="submit"] {
2016-05-20 01:11:43 +05:30
background: url('./images/loader_button.gif') #95a5a6 center center;
cursor: default;
color: #fff;
transition: 0.25s;
outline: none;
}
}
.captcha {
width: 302px;
height: 76px;
// minimum captcha width is 302px, which can not be changed
// using transform to scale down to 296px
transform-origin: 0;
transform: scaleX(0.98);
}
/**
* Form validation
*/
// Disable any visual error indication
// .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;
// }
// }