Last active
August 6, 2019 05:02
-
-
Save rogeruiz/1616f44889040ac138b1 to your computer and use it in GitHub Desktop.
Gravity Forms SCSS Module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$color--form-background: #fcfcfc; | |
$color--form-text: #333; | |
$color--form-border: #e5e4e4; | |
$color--radio-checkbox: #555; | |
$color--blue: blue; | |
$color--pink: pink; | |
$color--red: red; | |
$color--validation: $color--red; | |
$color--required: $color--red; | |
$color--error: $color--red; | |
$color--submit-background: $color--blue; | |
$color--submit-hover: $color--pink; | |
$transition-delay: 150ms; | |
$border-radius: 3px !default; | |
@mixin input-placeholder { | |
&.placeholder { @content; } | |
&:-moz-placeholder { @content; } | |
&::-moz-placeholder { @content; } | |
&:-ms-input-placeholder { @content; } | |
&::-webkit-input-placeholder { @content; } | |
} | |
@mixin all_inputs { | |
textarea, | |
select, | |
input[type="date"], | |
input[type="datetime"], | |
input[type="datetime-local"], | |
input[type="email"], | |
input[type="submit"], | |
input[type="month"], | |
input[type="number"], | |
input[type="password"], | |
input[type="search"], | |
input[type="tel"], | |
input[type="text"], | |
input[type="time"], | |
input[type="url"], | |
input[type="week"] { | |
@content; | |
} | |
} | |
%form-control { | |
display: block; | |
width: 100%; | |
padding: 0.7rem 1rem; | |
font-size: 1rem; | |
color: $color--form-text; | |
background-color: $color--form-background; | |
background-image: none; | |
border: 1px solid $color--form-border; | |
border-radius: $border-radius; | |
@include transition(all $transition-delay); | |
&[disabled], | |
&[readonly], | |
fieldset[disabled] & { | |
cursor: not-allowed; | |
background-color: darken($color--form-background, 3%); | |
opacity: 1; | |
} | |
@include input-placeholder { | |
color: lighten($color--form-text, 30%); | |
} | |
&::-ms-clear { | |
display: none; | |
} | |
&:focus { | |
outline: 0; | |
border-color: $color--blue; | |
} | |
} | |
// Gravity form Classes | |
.gform_confirmation_wrapper { | |
color: $color--blue; | |
font-weight: 400; | |
margin: 2rem 0; | |
} | |
.gform_wrapper { | |
ul { | |
margin: 0; | |
padding: 0; | |
list-style: none; | |
} | |
label { | |
text-transform: uppercase; | |
color: $color--form-text; | |
font-weight: 600; | |
} | |
input[type="text"], | |
input[type="email"], | |
select, | |
textarea { | |
@extend %form-control; | |
} | |
.gfield_error { | |
input[type="text"], | |
input[type="email"], | |
select, | |
textarea { | |
border: 1px solid $color--error; | |
} | |
} | |
select { | |
height: 49px; | |
font-size: 1rem; | |
padding: 0.7rem 1rem; | |
} | |
input[type="submit"] { | |
font-size: 1rem; | |
padding: 0.7rem 1rem 0.55rem; | |
background-color: $color--submit-background; | |
&:hover { | |
background-color: $color--submit-hover; | |
} | |
&:focus { | |
outline: 0; | |
} | |
} | |
.gfield { | |
margin-bottom: 1rem; | |
} | |
.gform_body { | |
margin: 1rem 0; | |
} | |
.gform_footer { | |
margin: 2.5rem 0 1rem; | |
} | |
.gfield_required { | |
color: $color--required; | |
} | |
.validation_error { | |
text-transform: uppercase; | |
font-weight: 400; | |
color: $color--error; | |
margin-top: 1rem; | |
} | |
.validation_message { | |
color: $color--validation; | |
font-size: 0.8rem; | |
font-weight: 600; | |
} | |
.gfield_checkbox, | |
.gfield_radio { | |
input[type="radio"], | |
input[type="checkbox"] { | |
margin: -2px 0 0; | |
margin-top: 1px \9; // IE8-9 | |
line-height: normal; | |
border: 1px solid darken($color--form-border, 5%); | |
background: darken($color--form-background, 5%); | |
color: $color--radio-checkbox; | |
height: 16px; | |
outline: 0; | |
text-align: center; | |
vertical-align: middle; | |
width: 16px; | |
min-width: 16px; | |
@include appearance(none); | |
&:checked { | |
&:before { | |
float: left; | |
display: inline-block; | |
vertical-align: middle; | |
} | |
} | |
&[disabled], | |
&.disabled, | |
fieldset[disabled] & { | |
opacity: 0.5; | |
cursor: not-allowed; | |
} | |
} | |
input[type="checkbox"] { | |
border-radius: 2px; | |
&:checked { | |
&:before { | |
content: '\2714'; | |
margin: -3px 0 0 2px; | |
font-size: 0.8rem; | |
color: $color--blue; | |
} | |
} | |
} | |
input[type="radio"] { | |
border-radius: 999px; | |
&:checked { | |
&:before { | |
content: '\2022'; | |
text-indent: -9999px; | |
border-radius: 999px; | |
font-size: 24px; | |
width: 6px; | |
height: 6px; | |
margin: 4px; | |
line-height: 16px; | |
background-color: $color--blue; | |
} | |
} | |
} | |
li { | |
position: relative; | |
display: block; | |
margin-top: 10px; | |
margin-bottom: 10px; | |
} | |
label { | |
padding-left: 4px; | |
margin-bottom: 0; | |
cursor: pointer; | |
text-transform: none; | |
color: $color--form-text; | |
font-weight: 300; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment