0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-25 02:31:59 -05:00

Var cleanup

This commit is contained in:
Paul Adam Davis 2014-10-26 17:07:35 +00:00
parent 4ae81799c3
commit d314727506
17 changed files with 94 additions and 225 deletions

View file

@ -87,7 +87,7 @@
padding: 18px; padding: 18px;
background-clip: padding-box; background-clip: padding-box;
background-color: #FFFFFF; background-color: #FFFFFF;
border-radius: $rounded; border-radius: $border-radius;
box-shadow: rgba(0,0,0,0.2) 0 0 0 6px; box-shadow: rgba(0,0,0,0.2) 0 0 0 6px;
.close { .close {

View file

@ -12,7 +12,7 @@
left: 0; left: 0;
z-index: 800; z-index: 800;
background: $darkgrey; background: $darkgrey;
transition: transform $side-outlet-transition-duration cubic-bezier(0.1, 0.7, 0.1, 1); transition: transform $settings-menu-transition cubic-bezier($settings-menu-bezier);
i:before { i:before {
display: inline-block; display: inline-block;
@ -190,7 +190,7 @@
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
transform: translate3d(-60px, 0px, 0px); // Not off the screen, to give a parallax effect transform: translate3d(-60px, 0px, 0px); // Not off the screen, to give a parallax effect
transition: transform $side-outlet-transition-duration cubic-bezier(0.1, 0.7, 0.1, 1); transition: transform $settings-menu-transition cubic-bezier($settings-menu-bezier);
.thing, .thing2 { .thing, .thing2 {
display: block; display: block;
@ -317,7 +317,7 @@
bottom: 0; bottom: 0;
left: 0; left: 0;
z-index: 600; z-index: 600;
transition: transform $side-outlet-transition-duration cubic-bezier(0.1, 0.7, 0.1, 1); transition: transform $settings-menu-transition cubic-bezier($settings-menu-bezier);
transform: translate3d(260px, 0px, 0px); // Not off the screen, to give a parallax effect transform: translate3d(260px, 0px, 0px); // Not off the screen, to give a parallax effect
}//.nav-cover }//.nav-cover
}//body.global-nav-expanded }//body.global-nav-expanded

View file

@ -11,7 +11,7 @@
left: 0; left: 0;
z-index: 980; z-index: 980;
width: 300px; width: 300px;
transition: transform $side-outlet-transition-duration cubic-bezier(0.1, 0.7, 0.1, 1); transition: transform $settings-menu-transition cubic-bezier($settings-menu-bezier);
// This selector ends up being `body.settings-menu-expanded .notifications` // This selector ends up being `body.settings-menu-expanded .notifications`
body.settings-menu-expanded & { body.settings-menu-expanded & {
@ -25,7 +25,7 @@
left: 0; left: 0;
right: 0; right: 0;
z-index: 9999; z-index: 9999;
transition: transform $side-outlet-transition-duration cubic-bezier(0.1, 0.7, 0.1, 1); transition: transform $settings-menu-transition cubic-bezier($settings-menu-bezier);
// This selector ends up being `body.settings-menu-expanded .notifications` // This selector ends up being `body.settings-menu-expanded .notifications`
body.settings-menu-expanded & { body.settings-menu-expanded & {
@ -62,7 +62,7 @@
color: rgba(255,255,255,0.9); color: rgba(255,255,255,0.9);
background: $blue; background: $blue;
position: relative; position: relative;
box-shadow: $shadow; box-shadow: $box-shadow;
transform: translateZ(0); transform: translateZ(0);
@media (max-width: 400px) { @media (max-width: 400px) {

View file

@ -5,7 +5,7 @@
display: inline-block; display: inline-block;
padding-left: 0; padding-left: 0;
margin: 20px 0; margin: 20px 0;
border-radius: $rounded; border-radius: $border-radius;
> li { > li {
display: inline; // Remove list-style and block-level defaults display: inline; // Remove list-style and block-level defaults
@ -25,15 +25,15 @@
> a, > a,
> span { > span {
margin-left: 0; margin-left: 0;
border-top-left-radius: $rounded; border-top-left-radius: $border-radius;
border-bottom-left-radius: $rounded; border-bottom-left-radius: $border-radius;
} }
} }
&:last-child { &:last-child {
> a, > a,
> span { > span {
border-top-right-radius: $rounded; border-top-right-radius: $border-radius;
border-bottom-right-radius: $rounded; border-bottom-right-radius: $border-radius;
} }
} }
} }

View file

@ -13,7 +13,7 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
overflow: hidden; overflow: hidden;
transition: transform $side-outlet-transition-duration cubic-bezier(0.1, 0.7, 0.1, 1); transition: transform $settings-menu-transition cubic-bezier($settings-menu-bezier);
transform: translate3d(60px, 0px, 0px); transform: translate3d(60px, 0px, 0px);
// This selector ends up being `body.settings-menu-expanded .settings-menu-container` // This selector ends up being `body.settings-menu-expanded .settings-menu-container`
@ -32,7 +32,7 @@
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
@media (min-width: 901px) { @media (min-width: 901px) {
transition: transform $side-outlet-transition-duration cubic-bezier(0.1, 0.7, 0.1, 1); transition: transform $settings-menu-transition cubic-bezier($settings-menu-bezier);
} }
&.settings-menu-pane-out-left { &.settings-menu-pane-out-left {
@ -164,7 +164,7 @@ body.settings-menu-expanded {
bottom: 0; bottom: 0;
left: 0; left: 0;
z-index: 600; z-index: 600;
transition: transform $side-outlet-transition-duration cubic-bezier(0.1, 0.7, 0.1, 1); transition: transform $settings-menu-transition cubic-bezier($settings-menu-bezier);
transform: translate3d(-350px, 0px, 0px); // Not off the screen, to give a parallax effect transform: translate3d(-350px, 0px, 0px); // Not off the screen, to give a parallax effect
}//.editor-cover }//.editor-cover

View file

@ -43,7 +43,7 @@
left: 0; left: 0;
color: $brown; color: $brown;
text-decoration: none; text-decoration: none;
@include user-select(none); user-select: none;
&:hover { &:hover {
cursor: pointer; cursor: pointer;
@ -189,7 +189,7 @@
color: #fff; color: #fff;
text-decoration: none; text-decoration: none;
line-height: 0; line-height: 0;
border-radius: $rounded; border-radius: $border-radius;
background: rgba(0,0,0,0.6); background: rgba(0,0,0,0.6);
box-shadow: rgba(255,255,255,0.2) 0 0 0 1px; box-shadow: rgba(255,255,255,0.2) 0 0 0 1px;

View file

@ -179,7 +179,7 @@
background: $darkgrey; background: $darkgrey;
color: #fff; color: #fff;
padding: 2px 6px 3px; padding: 2px 6px 3px;
border-radius: $rounded; border-radius: $border-radius;
transition: opacity 0.15s ease-in-out; transition: opacity 0.15s ease-in-out;
font-size: 1rem; font-size: 1rem;
pointer-events: none; pointer-events: none;

View file

@ -24,10 +24,10 @@
left: 0; left: 0;
overflow: hidden; overflow: hidden;
z-index: 500; // Above the .global-nav when collapsed z-index: 500; // Above the .global-nav when collapsed
transition: transform $side-outlet-transition-duration cubic-bezier(0.1, 0.7, 0.1, 1); transition: transform $settings-menu-transition cubic-bezier($settings-menu-bezier);
@media (max-width: 900px) { @media (max-width: 900px) {
transition: transform 0.4s cubic-bezier(0.1, 0.7, 0.1, 1); transition: transform 0.4s cubic-bezier($settings-menu-bezier);
} }
// This selector ends up being `body.settings-menu-expanded .viewport` // This selector ends up being `body.settings-menu-expanded .viewport`

View file

@ -272,7 +272,7 @@
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
word-break: break-word; word-break: break-word;
hyphens: auto; hyphens: auto;
@include user-select(none); user-select: none;
cursor: default; cursor: default;
// Tweak padding for smaller screens // Tweak padding for smaller screens
@ -521,10 +521,10 @@ body.zen {
color: $lightgrey; color: $lightgrey;
white-space: nowrap; white-space: nowrap;
background: lighten($grey, 15%); background: lighten($grey, 15%);
border-radius: $rounded; border-radius: $border-radius;
box-shadow: rgba(255,255,255,0.2) 0 1px 0 inset, #000 0 1px 3px; box-shadow: rgba(255,255,255,0.2) 0 1px 0 inset, #000 0 1px 3px;
@include user-select(none); user-select: none;
&:hover { &:hover {
cursor: pointer; cursor: pointer;

View file

@ -51,7 +51,7 @@
color: rgba(255,255,255,0.8); color: rgba(255,255,255,0.8);
z-index: 2; z-index: 2;
border-width: 0; border-width: 0;
border-radius: $rounded; border-radius: $border-radius;
transition: color 0.3s ease, background 0.3s ease; transition: color 0.3s ease, background 0.3s ease;
@media (max-width: 1000px) { @media (max-width: 1000px) {
right: 15px; right: 15px;
@ -135,7 +135,7 @@
.user-image { .user-image {
display: block; display: block;
position: absolute; position: absolute;
@media (min-width: 651px) { @media (min-width: 651px) {
top: -19px; top: -19px;
left: -98px; left: -98px;
@ -145,7 +145,7 @@
top: -159px; top: -159px;
left: 21px; left: 21px;
} }
width: 126px; width: 126px;
height: 126px; height: 126px;
float: left; float: left;

View file

@ -15,24 +15,32 @@
} }
//
// The Icon (before) Mixin
// --------------------------------------------------
%icon-base {
font-family: "GhostIcons";
font-weight: normal;
font-style: normal;
vertical-align: -7%;
text-transform:none;
speak: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
// //
// The Icon (before) Mixin // The Icon (before) Mixin
// -------------------------------------------------- // --------------------------------------------------
@mixin icon($char, $size: '', $color: '') { @mixin icon($char, $size: '', $color: '') {
&:before { &:before {
// Base @extend %icon-base;
font-family: "GhostIcons";
font-weight: normal;
font-style: normal;
vertical-align: -7%;
text-transform:none;
speak: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
//Function
content: '#{$char}'; content: '#{$char}';
@if $size != '' { @if $size != '' {
font-size: $size; font-size: $size;
@ -54,18 +62,8 @@
@mixin icon-after($char, $size: '', $color: '') { @mixin icon-after($char, $size: '', $color: '') {
&:after { &:after {
// Base @extend %icon-base;
font-family: "GhostIcons";
font-weight: normal;
font-style: normal;
vertical-align: -7%;
text-transform:none;
speak: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
// Function
content: '#{$char}'; content: '#{$char}';
@if $size != '' { @if $size != '' {
font-size: $size; font-size: $size;
@ -89,7 +87,7 @@
// Private Use Area characters. This means that screen readers won't attempt to // Private Use Area characters. This means that screen readers won't attempt to
// read them out loud. For code maintainability, we then store these Unicode // read them out loud. For code maintainability, we then store these Unicode
// references inside Sass variables. // references inside Sass variables.
// //
// Placeholder // Placeholder
$i: \e018; $i: \e018;
@ -168,15 +166,7 @@ $i-code: \e03e;
[class*=icon-] { [class*=icon-] {
&:before { &:before {
// Base @extend %icon-base;
font-family: "GhostIcons";
font-weight: normal;
font-style: normal;
vertical-align: -7%;
text-transform:none;
speak: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
} }
&:hover { &:hover {
@ -189,11 +179,6 @@ $i-code: \e03e;
// Icon Classes // Icon Classes
// -------------------------------------------------- // --------------------------------------------------
[class*='icon-'] {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-ghost:before { .icon-ghost:before {
content: '#{$i-ghost}'; content: '#{$i-ghost}';
} }

View file

@ -1,109 +1,38 @@
// //
// Styles // Mixins
// -------------------------------------------------- // --------------------------------------------------
// Baseline margin
@mixin baseline { @mixin baseline {
margin: 1.6em 0; margin: 1.6em 0;
} }
// Fix for clearing float-based overflows
@mixin clearfix { @mixin clearfix {
&:after { &:after {
content:""; content: "";
display:table; display: table;
clear:both; clear: both;
} }
} }
// User select
// For selecting text on the page
@mixin user-select($select) {
-webkit-user-select: $select;
-moz-user-select: $select;
-ms-user-select: $select; // IE10+
user-select: $select;
}
// WebKit-style focus // WebKit-style focus
// From Bootstrap
@mixin tab-focus() { @mixin tab-focus() {
// Default // Default
outline: thin dotted; outline: thin dotted;
// WebKit // WebKit
outline: 0px auto -webkit-focus-ring-color; outline: 0px auto -webkit-focus-ring-color;
outline-offset: -2px; outline-offset: -2px;
} }
@mixin form-control-focus($color: #66afe9) { // Simple SCSS mixin to create CSS triangles
$color-rgba: rgba(red($color), green($color), blue($color), .6); // Example: @include css-triangle (10px, #fff, "up");
&:focus { @mixin triangle($size: 20px, $color: #000, $direction: "down", $type: "normal") {
border-color: $color;
outline: 0;
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px $color-rgba;
}
}
@mixin input-size($parent, $input-height, $padding-vertical, $padding-horizontal, $font-size, $line-height, $border-radius) {
#{$parent} {
height: $input-height;
padding: $padding-vertical $padding-horizontal;
font-size: $font-size;
line-height: $line-height;
border-radius: $border-radius;
}
select#{$parent} {
height: $input-height;
line-height: $input-height;
}
textarea#{$parent},
select[multiple]#{$parent} {
height: auto;
}
}
@mixin form-control-validation($text-color: #555, $border-color: #ccc, $background-color: #f5f5f5) {
// Color the label and help text
.help-block,
.control-label,
.radio,
.checkbox,
.radio-inline,
.checkbox-inline {
color: $text-color;
}
// Set the border and box shadow on specific inputs to match
.form-control {
border-color: $border-color;
box-shadow: inset 0 1px 1px rgba(0,0,0,.075); // Redeclare so transitions work
&:focus {
border-color: darken($border-color, 10%);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten($border-color, 20%);
}
}
// Set validation states also for addons
.input-group-addon {
color: $text-color;
border-color: $border-color;
background-color: $background-color;
}
// Optional feedback icon
.form-control-feedback {
color: $text-color;
}
}
@mixin make-row($gutter: 30px) {
margin-left: ($gutter / -2);
margin-right: ($gutter / -2);
@include clearfix();
}
//==== Simple SCSS mixin to create CSS triangles
//==== Example: @include css-triangle (10px, #fff, "up");
@mixin triangle ($size: 20px, $color: #000, $direction: "down", $type: "normal") {
$verticalSize: $size; $verticalSize: $size;
width: 0; width: 0;
height: 0; height: 0;
@ -135,12 +64,11 @@
border-bottom: $size solid #{setTriangleColor($direction, "bottom", $color)}; border-bottom: $size solid #{setTriangleColor($direction, "bottom", $color)};
border-top: $size solid #{setTriangleColor($direction, "top", $color)}; border-top: $size solid #{setTriangleColor($direction, "top", $color)};
} }
} }
//Utility function to return the relevant colour depending on what type of arrow it is
@function setTriangleColor($direction, $side, $color) {
// Utility function to return the relevant colour depending on what type of arrow it is
@function setTriangleColor($direction, $side, $color) {
@if $direction == "left" and $side == "right" @if $direction == "left" and $side == "right"
or $direction == "right" and $side == "left" or $direction == "right" and $side == "left"
or $direction == "down" and $side == "top" or $direction == "down" and $side == "top"
@ -149,5 +77,4 @@
} @else { } @else {
@return "transparent"; @return "transparent";
} }
} }

View file

@ -1,7 +1,13 @@
// ------------------------------------------------------------
// Variables
// //
// Colours // * Colours
// -------------------------------------------------- // * Default style values
// * Dropdown & Popover triangles
// ------------------------------------------------------------
// Colours
$darkgrey: #242628; $darkgrey: #242628;
$grey: #35393b; $grey: #35393b;
$midgrey: #7d878a; $midgrey: #7d878a;
@ -15,68 +21,19 @@ $red: #e25440;
$orange: #F2A925; $orange: #F2A925;
$green: #9FBB58; $green: #9FBB58;
$list-colours:
('darkgrey' $darkgrey)
('grey' $grey)
('midgrey' $midgrey)
('lightgrey' $lightgrey)
('brown' $brown)
('midbrown' $midbrown)
('lightbrown' $lightbrown)
('blue' $blue)
('red' $red)
('orange' $orange)
('green' $green);
// Default style values
//
// Styles
// -------------------------------------------------- // --------------------------------------------------
$rounded: 3px; $border-radius: 3px;
$shadow: rgba(0,0,0,0.05) 0 1px 5px; $box-shadow: rgba(0,0,0,0.05) 0 1px 5px;
$default-transition-duration: 0.3s; $settings-menu-transition: 0.4s;
$side-outlet-transition-duration: 0.4s; $settings-menu-bezier: 0.1, 0.7, 0.1, 1;
$font-family: 'Open Sans', sans-serif; $font-family: 'Open Sans', sans-serif;
$font-family-mono: monospace; $font-family-mono: monospace;
$at2x: 2 device-pixel-ratio;
// Dropdown & Popover triangles
$dropdown_triangle: 8px; $dropdown_triangle: 8px;
$popover_triangle: 14px; $popover_triangle: 14px;
$popover_triangle_shallow_multiplier: 0.8; $popover_triangle_shallow_multiplier: 0.8; // Adjusts the height of the triangle relative to its width, so it's 0.8x the height of the width
$padding-small-horizontal: 10px !default;
$padding-large-horizontal: 16px !default;
$input-height-base: (20px + (6px * 2) + 2) !default;
$input-height-small: (floor(12px * 1.5) + (5px * 2) + 2) !default;
$input-height-large: (ceil(18px * 1.33) + (10px * 2) + 2) !default;
$border-radius-large: 6px !default;
$border-radius-small: 3px !default;
$state-success-text: #3c763d !default;
$state-success-bg: #dff0d8 !default;
$state-warning-text: #8a6d3b !default;
$state-warning-bg: #fcf8e3 !default;
$state-danger-text: #a94442 !default;
$state-danger-bg: #f2dede !default;
$screen-md: 992px !default;
$screen-md-min: $screen-md !default;
$screen-sm: 768px !default;
$screen-sm-min: $screen-sm !default;
$grid-gutter-width: 30px !default;

View file

@ -22,8 +22,8 @@
background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214 background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
border: 1px solid transparent; border: 1px solid transparent;
white-space: nowrap; white-space: nowrap;
border-radius: $rounded; border-radius: $border-radius;
@include user-select(none); user-select: none;
&, &,
&:active, &:active,

View file

@ -151,7 +151,7 @@ select {
padding: 8px 10px; padding: 8px 10px;
width: 100%; width: 100%;
border: 1px solid #E0DFD7; border: 1px solid #E0DFD7;
border-radius: $rounded; border-radius: $border-radius;
font-size: 1.4rem; font-size: 1.4rem;
font-weight: normal; font-weight: normal;
@ -190,7 +190,7 @@ textarea {
// </div> // </div>
.for-checkbox { .for-checkbox {
.input-toggle-component { .input-toggle-component {
border-radius: $rounded; border-radius: $border-radius;
} }
label { label {
.input-toggle-component { .input-toggle-component {

View file

@ -7,7 +7,7 @@
padding: 0; padding: 0;
border: 1px solid #E0DFD7; border: 1px solid #E0DFD7;
max-width: 500px; max-width: 500px;
border-radius: $rounded; border-radius: $border-radius;
background: #FFF; background: #FFF;
&.nav-list-block { &.nav-list-block {
@ -31,12 +31,12 @@
} }
&:first-of-type { &:first-of-type {
border-top-left-radius: $rounded; border-top-left-radius: $border-radius;
border-top-right-radius: $rounded; border-top-right-radius: $border-radius;
} }
&:last-of-type { &:last-of-type {
border-bottom-left-radius: $rounded; border-bottom-left-radius: $border-radius;
border-bottom-right-radius: $rounded; border-bottom-right-radius: $border-radius;
} }
&:not(:last-of-type) { &:not(:last-of-type) {

View file

@ -19,7 +19,7 @@
// //
// Patterns: Groups of styles // Patterns: Groups of Styles
// -------------------------------------------------- // --------------------------------------------------
@import "patterns/global"; @import "patterns/global";