skill-assessment-app/app/assets/stylesheets/molecules/_forms.scss

304 lines
5.0 KiB
SCSS
Raw Normal View History

2016-07-28 12:52:54 -05:00
// TODO: Align colors with variables.scss
fieldset {
background-color: transparent;
border: none;
padding: 0;
margin: 0;
2016-08-04 18:03:23 -05:00
&:disabled {
label {
display: none;
}
.form-group-multiples {
label {
display: block;
}
}
}
2016-07-28 12:52:54 -05:00
}
legend {
font-weight: 300;
margin-bottom: $small-spacing / 2;
padding: 0;
}
label {
display: block;
font-weight: 300;
}
form.btn-center {
text-align: center;
}
2016-07-28 12:52:54 -05:00
#{$all-text-inputs} {
display: block;
font-size: $base-font-size;
2016-08-11 17:02:17 -05:00
border: none;
border-bottom: 1px solid $secondary-color;
2016-07-28 12:52:54 -05:00
box-shadow: none;
border-radius: $base-border-radius;
box-sizing: border-box;
margin-bottom: 1.4em;
padding: $base-spacing / 3;
width: 100%;
font-weight: 300;
font-family: $primary-font-face;
line-height: 1.5em;
&:focus {
outline: none;
2016-07-29 15:01:01 -05:00
box-shadow: none;
2016-07-28 12:52:54 -05:00
}
&:disabled {
background-color: shade($base-background-color, 5%);
cursor: default;
2016-08-11 17:02:17 -05:00
border-bottom-color: #bbb;
2016-07-28 12:52:54 -05:00
}
}
button:disabled,
input[type='submit']:disabled {
opacity: .3;
cursor: default;
}
textarea {
resize: vertical;
background: transparent;
padding: 0 0 3rem;
}
2016-08-09 23:17:35 -05:00
.summary_tpl textarea {
padding: 1rem 1rem 3rem;
}
2016-07-28 12:52:54 -05:00
[type="search"] {
appearance: none;
}
%multiple-choice {
display: inline;
margin-right: $small-spacing / 2;
&:not(:checked),
&:checked {
position: absolute;
left: -9999px;
+ label {
position: relative;
padding-left: 25px;
cursor: pointer;
&:after {
position: absolute;
line-height: 0.8;
color: $primary-color;
transition: all .2s;
}
}
&:disabled {
+ label {
&:before {
box-shadow: none;
border-color: #bbb;
background-color: #ddd;
}
}
}
}
&:not(:checked) {
+ label {
&:after {
opacity: 0;
transform: scale(0);
}
}
}
&:checked {
+ label {
&:before {
border: 1px solid $gray;
background: transparent;
}
&:after {
opacity: 1;
transform: scale(1);
}
}
&:disabled {
+ label {
&:after {
color: #999;
}
}
}
}
&:hover:not(:disabled) {
+ label {
&:before {
border: 2px solid $primary-color;
}
}
}
&:disabled {
+ label {
color: #aaa;
}
}
+ label {
&:before {
content: '';
position: absolute;
2016-08-04 08:50:31 -05:00
left:0;
top: 2px;
width: 20px;
height: 20px;
2016-07-28 12:52:54 -05:00
box-shadow: 0;
border: 1px solid $primary-color;
background: transparent;
box-sizing: border-box;
}
}
}
[type="radio"] {
@extend %multiple-choice;
&:not(:checked),
&:checked {
+ label {
&:after {
2016-08-04 08:50:31 -05:00
content: '';
position: absolute;
width: 8px;
height: 8px;
top: 8px;
left: 6px;
background-color: $primary-color;
border-radius: 100%;
2016-07-28 12:52:54 -05:00
}
}
}
+ label {
&:before {
border-radius: 50%;
}
}
&:not(:disabled) + label:before {
background-color: white;
}
2016-08-04 17:25:12 -05:00
&:disabled {
+ label {
&:after {
background-color: #888;
}
}
}
2016-07-28 12:52:54 -05:00
}
[type="checkbox"] {
@extend %multiple-choice;
&:not(:checked),
&:checked {
+ label {
&:after {
font-family: 'Zapf Dingbats', 'Menlo';
content: '\2714';
font-size: 13px;
top: 7px;
left: 5px;
}
}
}
&:not(:disabled) + label:before {
background-color: white;
}
}
[type="file"] {
margin-bottom: $small-spacing;
width: 100%;
}
select {
margin-bottom: 0.75em;
max-width: 100%;
width: auto; // needed?
background-color: $white;
border: 1px solid #aaa;
border-radius: 0px;
font-weight: 300;
font-family: $primary-font-face;
font-size: 1rem;
&::-ms-expand {
display: none;
}
&:not([multiple]) {
2016-07-31 14:27:58 -05:00
background-image: asset_data_url("icon-dropdownlist.png");
2016-07-28 12:52:54 -05:00
background-repeat: no-repeat;
background-position: right 10px bottom 50%;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
padding: 10px 40px 10px 10px;
}
option {
font-weight: 300;
font-family: $primary-font-face;
font-size: 1rem;
}
}
.form-group {
position: relative;
margin-bottom: 1.2rem;
label {
transition: 0.2s ease;
+ #{$all-text-inputs} {
background: transparent;
}
&.loaded {
left: 0;
top: 5px;
font-size: 1em;
position: absolute;
pointer-events: none;
}
&.animate {
font-size: 0.8em;
top: -10px;
}
}
}
2016-08-12 14:32:03 -05:00
label[for="answer_text"],
label[for="answer_live_code"] {
font-weight: 400;
font-style: italic;
2016-08-11 17:02:17 -05:00
}
2016-08-12 14:32:03 -05:00
2016-07-28 12:52:54 -05:00
.form-group-multiples { // radios, checks wrappers
margin-bottom: .5rem;
}
.button-group {
margin-top: 2rem;
}
.skills-app-form {
margin-top: 2rem;
}
.resolve-error {
animation-name: success-fadeout;
animation-duration: 1.5s;
animation-delay: 0;
animation-fill-mode: forwards;
}
2016-07-28 12:52:54 -05:00
html.no-js {
.chars {
display: none;
}
}