Last active
November 29, 2016 20:00
-
-
Save somecallmejosh/c5bfd745bef0a54173cf20d5e848d56a to your computer and use it in GitHub Desktop.
Form Styles
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
$field-height: 50px; | |
.atkForm { | |
input, | |
input[type="search"], | |
textarea { | |
/* For Safari zooming issues */ | |
-webkit-appearance: none; | |
-webkit-tap-highlight-color: rgba(0,0,0,0); | |
font-size: 16px; | |
padding: 0; | |
} | |
&__group { | |
background-color: #fff; | |
border: #ccc 1px solid; | |
border-bottom: none; | |
height: $field-height; | |
position: relative; | |
width: 100%; | |
&:last-child { | |
border-bottom: #ccc 1px solid; | |
} | |
&--error { | |
display: none; | |
color: red; | |
font: 10px "Montserrat", sans-serif; | |
position: absolute; | |
z-index: 2; | |
text-transform: uppercase; | |
.invalid & { | |
display: block; | |
} | |
} | |
&--input, | |
&--label { | |
left: 10px; | |
position: absolute; | |
top: 50%; | |
transform: translateY(-50%); | |
z-index: 1; | |
} | |
&--input { | |
background-color: transparent; | |
border: none; | |
color: #313131; | |
font: 400 15px 'Montserrat', sans-serif; | |
height: $field-height - 10px; | |
outline: none; | |
width: calc(100% - 20px); | |
z-index: 1; | |
&:focus { | |
color: #666; | |
background-color: #fff; | |
} | |
&:required { | |
box-shadow:none; | |
} | |
&.has-value { | |
background-color: #fff; | |
} | |
} | |
&--label { | |
color: #ccc; | |
font: italic 400 14px 'Merriweather', serif; | |
z-index: 0; | |
} | |
&--message { | |
color: #ccc; | |
cursor: pointer; | |
font: 10px "Montserrat", sans-serif; | |
padding: 5px; | |
position: absolute; | |
right: 0; | |
text-align: right; | |
top: 0; | |
z-index: 2; | |
&:hover { | |
color: #999; | |
} | |
span { | |
color: #fff; | |
background-color: #ccc; | |
border-radius: 100%; | |
display: inline-block; | |
height: 12px; | |
text-align: center; | |
width: 12px; | |
vertical-align: middle; | |
} | |
} | |
} | |
&__submit { | |
-webkit-appearance: none; | |
background-color: #333; | |
border: #333 1px solid; | |
border-radius: 0; | |
color: #fff; | |
cursor: pointer; | |
font: 400 12px 'Montserrat', sans-serif; | |
height: $field-height; | |
text-transform: uppercase; | |
&:hover { | |
background-color: darken(#333, 10%); | |
} | |
} | |
&__submitted { | |
font: 400 12px 'Montserrat', sans-serif; | |
} | |
&__wrapper { | |
background-color: #f4f4f4; | |
padding: 10px; | |
border: #ccc 1px solid; | |
} | |
} | |
// Form Layout | |
.atkForm { | |
&--side-by-side { | |
display: flex; | |
width: 100%; | |
&.form-submitted { | |
display: block; | |
} | |
.atkForm { | |
&__action { | |
flex-basis: max-content; | |
max-height: $field-height; | |
overflow: hidden; | |
max-width: 40%; | |
} | |
&__fields { | |
flex: auto; | |
} | |
&__group { | |
&--error { | |
color: red; | |
left: 10px; | |
bottom: -30px; | |
} | |
} | |
&__submit { | |
width: 100%; | |
padding: 0 25px; | |
position: relative; | |
svg { | |
fill: #fff; | |
height: 20px; | |
width: 20px; | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translateX(-50%) translateY(-50%); | |
} | |
} | |
} | |
} | |
&--stacked { | |
.atkForm { | |
&__fields, | |
&__submit { | |
width: 100%; | |
} | |
&__fields { | |
margin-bottom: 10px; | |
} | |
&__group { | |
&--error { | |
background-color: pink; | |
border: red 1px solid; | |
padding: 5px; | |
right: 5px; | |
top: 5px; | |
} | |
} | |
&__submit { | |
height: $field-height - 10px; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment