Ghost/ghost/admin/assets/sass/patterns/forms.scss

334 lines
7.0 KiB
SCSS
Raw Normal View History

2014-07-30 08:57:36 +04:00
//
2014-08-05 18:12:27 +04:00
// Forms
2014-07-30 08:57:36 +04:00
// --------------------------------------------------
2014-08-05 18:12:27 +04:00
2014-08-14 19:29:34 +04:00
// Form Wrapper
form {
2014-07-30 08:57:36 +04:00
2014-08-14 19:29:34 +04:00
label {
display: block;
color: $darkgrey;
font-size: 1.3rem;
font-weight: bold;
2014-08-14 19:29:34 +04:00
}
2014-07-30 08:57:36 +04:00
2014-08-14 19:29:34 +04:00
} // form
2014-07-30 08:57:36 +04:00
2014-08-14 19:29:34 +04:00
// Form Groups
2014-08-05 18:12:27 +04:00
.form-group {
2014-08-14 19:29:34 +04:00
position: relative;
margin-bottom: 1.6em;
width: 100%;
max-width: 500px;
p {
margin: 4px 0 0 0;
color: #B3B2A8;
font-size: 1.3rem;
}
2014-07-30 08:57:36 +04:00
2014-08-05 18:12:27 +04:00
label {
2014-08-14 19:29:34 +04:00
margin-bottom: 4px;
2014-07-30 08:57:36 +04:00
}
2014-08-14 19:29:34 +04:00
@media (max-width: 550px) {
max-width: 100%;
}
2014-08-05 18:12:27 +04:00
2014-08-14 19:29:34 +04:00
} // .form-group
2014-07-30 08:57:36 +04:00
2014-08-14 19:29:34 +04:00
// If the from group has an icon...
.input-icon[class*='icon-'] {
position: relative;
display: block;
input[type="email"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="text"],
input[type="url"],
input[type="date"] {
2014-08-14 19:29:34 +04:00
padding-left: 3.2rem;
}
.gh-select {
select {
padding-left: 3.2rem;
}
}
2014-08-14 19:29:34 +04:00
&:before {
position: absolute;
top: 50%;
left: 1.1rem;
font-size: 1.3rem;
transform: translateY(-52%);
z-index: 100;
2014-08-14 19:29:34 +04:00
}
} // .thing[class*='icon-']
// Wrapper for input[type="radio"] and input[type="checkbox"] elements
.for-radio,
.for-checkbox {
@include clearfix;
2014-08-05 18:12:27 +04:00
2014-08-14 19:29:34 +04:00
label {
display: block;
padding-bottom: 4px;
p {
font-weight: normal;
color: #000;
}
&:hover {
input:not(:checked) + .input-toggle-component {
border-color: $midbrown;
}
}
}
2014-08-05 18:12:27 +04:00
2014-08-14 19:29:34 +04:00
input {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: -9999px;
2014-08-14 19:29:34 +04:00
}
2014-08-05 18:12:27 +04:00
2014-08-14 19:29:34 +04:00
.input-toggle-component {
position: relative;
top: 1px;
display: inline-block;
float: left;
width: 18px;
height: 18px;
margin-right: 7px;
background: #F7F7F3;
border: 1px solid $lightbrown;
}
2014-08-05 18:12:27 +04:00
2014-08-14 19:29:34 +04:00
p {
font-weight: normal;
color: #B3B2A8;
white-space: nowrap;
}
} // .for-radio, .for-checkbox
2014-08-05 18:12:27 +04:00
2014-08-14 19:29:34 +04:00
// Fieldsets
fieldset {
border: none;
margin: 0 0 3em 0;
padding: 0;
} // fieldset
2014-08-05 18:12:27 +04:00
2014-08-14 19:29:34 +04:00
// Legends
legend {
display: block;
width: 100%;
margin: 2em 0;
border-bottom: $lightbrown 1px solid;
font-size: 1.2em;
line-height: 2.0em;
color: $brown;
} // legend
// Input, textarea & select
2014-09-30 19:24:21 +04:00
.input,
input[type="email"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="text"],
input[type="url"],
input[type="date"],
2014-08-14 19:29:34 +04:00
textarea,
.gh-select,
select {
display: block;
padding: 8px 10px;
width: 100%;
border: 1px solid #E0DFD7;
2014-10-26 20:07:35 +03:00
border-radius: $border-radius;
2014-08-14 19:29:34 +04:00
font-size: 1.4rem;
font-weight: normal;
color: $darkgrey;
2014-08-05 18:12:27 +04:00
transition: border-color 0.15s linear;
2014-07-30 08:57:36 +04:00
2014-08-14 19:29:34 +04:00
&:focus {
border-color: $brown;
outline: 0;
2014-08-14 19:29:34 +04:00
}
2014-07-30 08:57:36 +04:00
2014-08-05 18:12:27 +04:00
}
2014-07-30 08:57:36 +04:00
2014-08-14 19:29:34 +04:00
textarea {
width: 100%;
max-width: 500px;
min-width: 250px;
height: auto;
min-height: 10rem;
line-height: 1.5;
resize: vertical;
2014-08-14 19:29:34 +04:00
}
2014-07-30 08:57:36 +04:00
2014-08-05 18:12:27 +04:00
2014-08-14 19:29:34 +04:00
// Checkboxes
// ---
// <div class="form-group for-checkbox">
// <label for="permalinks">Dated Permalinks</label>
// <label class="checkbox" for="thing">
// <input id="thing" type="checkbox">
// <span class="input-toggle-component"></span>
// <p>Include the date in your post URLs</p>
// </label>
// <p>This is a label</p>
// </div>
.for-checkbox {
.input-toggle-component {
2014-10-26 20:07:35 +03:00
border-radius: $border-radius;
2014-07-30 08:57:36 +04:00
}
2014-08-14 19:29:34 +04:00
label {
.input-toggle-component {
transition: background 0.15s ease-in-out, border-color 0.15s ease-in-out;
2014-08-14 19:29:34 +04:00
&:before {
transition: opacity 0.15s ease-in-out;
2014-08-14 19:29:34 +04:00
content: '';
position: absolute;
width: 10px;
height: 6px;
top: 4px;
left: 3px;
border: 2px solid #fff;
border-top: none;
border-right: none;
transform: rotate(-45deg);
2014-08-14 19:29:34 +04:00
opacity: 0;
}
}
input:checked + .input-toggle-component {
background: $green;
border-color: darken($green, 10%);
&:before {
opacity: 1;
}
}
2014-08-05 18:12:27 +04:00
}
2014-08-14 19:29:34 +04:00
}
2014-07-30 08:57:36 +04:00
2014-08-14 19:29:34 +04:00
// Radio Buttons
// ---
// <div class="form-group for-radio">
// <label>The Option Title</label>
// <label class="radio">
// <input name="testing" type="radio" value="no">
// <span class="input-toggle-component"></span>
// <p>No</p>
// </label>
// <p>What does this thing mean?</p>
// </div>
.for-radio {
.input-toggle-component {
border-radius: 100px; // Use px to prevent ovals
2014-08-05 18:12:27 +04:00
}
2014-08-14 19:29:34 +04:00
label {
.input-toggle-component {
transition: background 0.15s ease-in-out, border-color 0.15s ease-in-out;
2014-08-14 19:29:34 +04:00
&:before {
transition: opacity 0.15s ease-in-out;
2014-08-14 19:29:34 +04:00
content: '';
position: absolute;
width: 8px;
height: 8px;
top: 4px;
left: 4px;
background: #FFF;
border-radius: 100%;
opacity: 0;
}
}
input:checked + .input-toggle-component {
background: $green;
border-color: darken($green, 10%);
&:before {
opacity: 1;
}
}
2014-08-05 18:12:27 +04:00
}
}
2014-07-30 08:57:36 +04:00
2014-08-14 19:29:34 +04:00
// Select Component
// ---
// <span class="gh-select">
// {{view "select"
2014-08-14 19:29:34 +04:00
// id="activeTheme"
// name="general[activeTheme]"
// content=themes
// optionValuePath="content.name"
// optionLabelPath="content.label"
// value=activeTheme
// selection=selectedTheme}}
// </span>
.gh-select {
position: relative;
display: block;
overflow: hidden;
width: 100%;
max-width: 100%;
padding: 0;
border-width: 0;
@include icon-after($i-chevron-down, 0.85em, $midbrown) {
position: absolute;
top: 50%;
right: 0.8em;
2014-08-14 19:29:34 +04:00
margin-top: -0.5em;
pointer-events: none;
};
select {
appearance: none;
-webkit-appearance: none;
-moz-appearance: window;
text-indent: 0.01px;
text-overflow: "";
background: #fff;
outline: none;
padding: 8px 10px;
line-height: normal;
// This hides native gh-select button arrow in IE
&::-ms-expand {
display: none;
}
// Hover style - Not used, but works
&:hover {}
// This hides focus around selected option in FF
&:-moz-focusring {
color: transparent;
text-shadow: 0 0 0 #000;
}
} // select
} // .gh-select
// Firefox-specific size fixes
@-moz-document url-prefix() {
.gh-select {
border-width: 1px;
select {
padding: 7px 10px 7px 8px;
}
&:focus {
border-color: $brown;
}
2014-07-30 08:57:36 +04:00
}
} // @-moz-document