Merge pull request #4342 from PaulAdamDavis/sass-cleanup

Cleanup modules Sass
This commit is contained in:
John O'Nolan 2014-10-30 14:08:48 +01:00
commit 21bbb62a17
23 changed files with 265 additions and 346 deletions

View File

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

View File

@ -12,7 +12,7 @@
left: 0;
z-index: 800;
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 {
display: inline-block;
@ -190,7 +190,7 @@
-webkit-overflow-scrolling: touch;
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 {
display: block;
@ -317,7 +317,7 @@
bottom: 0;
left: 0;
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
}//.nav-cover
}//body.global-nav-expanded

View File

@ -11,7 +11,7 @@
left: 0;
z-index: 980;
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`
body.settings-menu-expanded & {
@ -25,7 +25,7 @@
left: 0;
right: 0;
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`
body.settings-menu-expanded & {
@ -62,7 +62,7 @@
color: rgba(255,255,255,0.9);
background: $blue;
position: relative;
box-shadow: $shadow;
box-shadow: $box-shadow;
transform: translateZ(0);
@media (max-width: 400px) {

View File

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

View File

@ -13,7 +13,7 @@
right: 0;
bottom: 0;
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);
// This selector ends up being `body.settings-menu-expanded .settings-menu-container`
@ -32,7 +32,7 @@
-webkit-overflow-scrolling: touch;
@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 {
@ -164,7 +164,7 @@ body.settings-menu-expanded {
bottom: 0;
left: 0;
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
}//.editor-cover

View File

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

View File

@ -1,153 +0,0 @@
//
// Styles
// --------------------------------------------------
@mixin baseline {
margin: 1.6em 0;
}
@mixin clearfix {
&:after {
content:"";
display:table;
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
@mixin tab-focus() {
// Default
outline: thin dotted;
// WebKit
outline: 0px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
@mixin form-control-focus($color: #66afe9) {
$color-rgba: rgba(red($color), green($color), blue($color), .6);
&:focus {
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;
width: 0;
height: 0;
@if $type == "shallow" {
$verticalSize: floor($size * $popover_triangle_shallow_multiplier);
}
@if $direction == "down" {
border-left: $size solid #{setTriangleColor($direction, "left", $color)};
border-right: $size solid #{setTriangleColor($direction, "right", $color)};
border-top: $verticalSize solid #{setTriangleColor($direction, "top", $color)};
}
@if $direction == "up" {
border-left: $size solid #{setTriangleColor($direction, "left", $color)};
border-right: $size solid #{setTriangleColor($direction, "right", $color)};
border-bottom: $verticalSize solid #{setTriangleColor($direction, "bottom", $color)};
}
@if $direction == "left" {
border-right: $verticalSize solid #{setTriangleColor($direction, "right", $color)};
border-top: $size solid #{setTriangleColor($direction, "top", $color)};
border-bottom: $size solid #{setTriangleColor($direction, "bottom", $color)};
}
@if $direction == "right" {
border-left: $verticalSize solid #{setTriangleColor($direction, "left", $color)};
border-bottom: $size solid #{setTriangleColor($direction, "bottom", $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) {
@if $direction == "left" and $side == "right"
or $direction == "right" and $side == "left"
or $direction == "down" and $side == "top"
or $direction == "up" and $side == "bottom" {
@return $color
} @else {
@return "transparent";
}
}

View File

@ -1,82 +0,0 @@
//
// Colours
// --------------------------------------------------
$darkgrey: #242628;
$grey: #35393b;
$midgrey: #7d878a;
$lightgrey: #e2edf2;
$lightestgrey: #FCFCFC;
$brown: #aaa9a2;
$midbrown: #c0bfb6;
$lightbrown: #edece4;
$blue: #5BA4E5;
$red: #e25440;
$orange: #F2A925;
$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);
//
// Styles
// --------------------------------------------------
$rounded: 3px;
$shadow: rgba(0,0,0,0.05) 0 1px 5px;
$default-transition-duration: 0.3s;
$side-outlet-transition-duration: 0.4s;
$font-family: 'Open Sans', sans-serif;
$font-family-mono: monospace;
$at2x: 2 device-pixel-ratio;
$dropdown_triangle: 8px;
$popover_triangle: 14px;
$popover_triangle_shallow_multiplier: 0.8;
$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

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

View File

@ -24,10 +24,10 @@
left: 0;
overflow: hidden;
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) {
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`

View File

@ -272,7 +272,7 @@
-webkit-overflow-scrolling: touch;
word-break: break-word;
hyphens: auto;
@include user-select(none);
user-select: none;
cursor: default;
// Tweak padding for smaller screens
@ -521,10 +521,10 @@ body.zen {
color: $lightgrey;
white-space: nowrap;
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;
@include user-select(none);
user-select: none;
&:hover {
cursor: pointer;

View File

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

View File

@ -1,5 +1,14 @@
// ------------------------------------------------------------
// Animations
//
// Fade in
// Keyframe animations used through Ghost
//
// * Define animations
// * Classed to use these animations
// ------------------------------------------------------------
//
// Define animations
// --------------------------------------------------
@keyframes fade-in {
@ -10,10 +19,6 @@
opacity: 1;
}
}
.fade-in {
animation: fade-in 0.2s;
animation-fill-mode: forwards;
}
@keyframes fade-in-snap {
to {
@ -21,10 +26,6 @@
}
}
//
// Fade in scale up
// --------------------------------------------------
@keyframes fade-in-scale {
from {
transform: scale(0.8);
@ -35,15 +36,6 @@
opacity: 1;
}
}
.fade-in-scale {
animation: fade-in-scale 0.2s;
animation-fill-mode: forwards;
}
//
// Fade out
// --------------------------------------------------
@keyframes fade-out {
from {
@ -53,15 +45,6 @@
opacity: 0;
}
}
.fade-out {
animation: fade-out 0.5s;
animation-fill-mode: forwards;
}
//
// Fade out inset box shadow for content page keyboard focus
// --------------------------------------------------
@keyframes keyboard-focus-style-fade-out {
from {
@ -70,4 +53,24 @@
to {
box-shadow: none;
}
}
//
// Classed to use these animations
// --------------------------------------------------
.fade-in {
animation: fade-in 0.2s;
animation-fill-mode: forwards;
}
.fade-in-scale {
animation: fade-in-scale 0.2s;
animation-fill-mode: forwards;
}
.fade-out {
animation: fade-out 0.5s;
animation-fill-mode: forwards;
}

View File

@ -1,6 +1,26 @@
// ------------------------------------------------------------
// Icons
//
// Pictos, by Drew Wilson - http://pictos.cc/
// Defined the @font-face rule for the icon font, as well as
// the base styles for when using icons.
// Includes the mixins for adding icons directly and the
// variables for each icon.
//
// * Font-face rule
// * Base styled for icons
// * Base styled for icons
// * The Icon (before) Mixin
// * The Icon (after) Mixin
// * Icon Variables
// * Icon Class Styles
// * Icon Classes
// ------------------------------------------------------------
//
// Font-face rule
// Icon-font is generated by http://icomoon.co
// Pictos, by Drew Wilson - http://pictos.cc/
// --------------------------------------------------
@font-face {
@ -15,24 +35,31 @@
}
//
// Base styled for icons
// --------------------------------------------------
%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
// --------------------------------------------------
@mixin icon($char, $size: '', $color: '') {
&:before {
// 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;
@extend %icon-base;
//Function
content: '#{$char}';
@if $size != '' {
font-size: $size;
@ -54,18 +81,8 @@
@mixin icon-after($char, $size: '', $color: '') {
&:after {
// 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;
@extend %icon-base;
// Function
content: '#{$char}';
@if $size != '' {
font-size: $size;
@ -87,9 +104,8 @@
// --------------------------------------------------
// For accessibility, icon characters in the icon font are stored in Unicode's
// 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
// references inside Sass variables.
//
// read them out loud.
//
// Placeholder
$i: \e018;
@ -168,15 +184,7 @@ $i-code: \e03e;
[class*=icon-] {
&:before {
// 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;
@extend %icon-base;
}
&:hover {
@ -189,11 +197,6 @@ $i-code: \e03e;
// Icon Classes
// --------------------------------------------------
[class*='icon-'] {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-ghost:before {
content: '#{$i-ghost}';
}

View File

@ -0,0 +1,102 @@
// ------------------------------------------------------------
// Mixins
//
// Mixins defined here are very general and used in mul
//
// * baseline()
// * clearfix()
// * tab-focus()
// * triangle()
// * set-triangle-color()
// ------------------------------------------------------------
//
// Baseline margin
// --------------------------------------------------
@mixin baseline {
margin: 1.6em 0;
}
//
// Fix for clearing float-based overflows
// --------------------------------------------------
@mixin clearfix {
&:after {
content: "";
display: table;
clear: both;
}
}
//
// WebKit-style focus
// From Bootstrap
// --------------------------------------------------
@mixin tab-focus() {
// Default
outline: thin dotted;
// WebKit
outline: 0px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
//
// 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;
width: 0;
height: 0;
@if $type == "shallow" {
$verticalSize: floor($size * $popover_triangle_shallow_multiplier);
}
@if $direction == "down" {
border-left: $size solid #{set-triangle-color($direction, "left", $color)};
border-right: $size solid #{set-triangle-color($direction, "right", $color)};
border-top: $verticalSize solid #{set-triangle-color($direction, "top", $color)};
}
@if $direction == "up" {
border-left: $size solid #{set-triangle-color($direction, "left", $color)};
border-right: $size solid #{set-triangle-color($direction, "right", $color)};
border-bottom: $verticalSize solid #{set-triangle-color($direction, "bottom", $color)};
}
@if $direction == "left" {
border-right: $verticalSize solid #{set-triangle-color($direction, "right", $color)};
border-top: $size solid #{set-triangle-color($direction, "top", $color)};
border-bottom: $size solid #{set-triangle-color($direction, "bottom", $color)};
}
@if $direction == "right" {
border-left: $verticalSize solid #{set-triangle-color($direction, "left", $color)};
border-bottom: $size solid #{set-triangle-color($direction, "bottom", $color)};
border-top: $size solid #{set-triangle-color($direction, "top", $color)};
}
}
//
// Utility function to return the relevant colour depending on what type of arrow it is
// --------------------------------------------------
@function set-triangle-color($direction, $side, $color) {
@if $direction == "left" and $side == "right"
or $direction == "right" and $side == "left"
or $direction == "down" and $side == "top"
or $direction == "up" and $side == "bottom" {
@return $color
} @else {
@return "transparent";
}
}

View File

@ -0,0 +1,46 @@
// ------------------------------------------------------------
// Variables
//
// * Colours
// * Default style values
// * Dropdown & Popover triangles
// ------------------------------------------------------------
//
// Colours
// --------------------------------------------------
$darkgrey: #242628;
$grey: #35393b;
$midgrey: #7d878a;
$lightgrey: #e2edf2;
$lightestgrey: #FCFCFC;
$brown: #aaa9a2;
$midbrown: #c0bfb6;
$lightbrown: #edece4;
$blue: #5BA4E5;
$red: #e25440;
$orange: #F2A925;
$green: #9FBB58;
//
// Default style values
// --------------------------------------------------
$border-radius: 3px;
$box-shadow: rgba(0,0,0,0.05) 0 1px 5px;
$settings-menu-transition: 0.4s;
$settings-menu-bezier: 0.1, 0.7, 0.1, 1;
$font-family: 'Open Sans', sans-serif;
$font-family-mono: monospace;
//
// Dropdown & Popover triangles
// --------------------------------------------------
$dropdown_triangle: 8px;
$popover_triangle: 14px;
$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

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
border: 1px solid transparent;
white-space: nowrap;
border-radius: $rounded;
@include user-select(none);
border-radius: $border-radius;
user-select: none;
&,
&:active,

View File

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

View File

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

View File

@ -1,21 +1,21 @@
//
// Helpers: Sass Utilities
// Modules: Mixins, variables, and utilities
// --------------------------------------------------
@import "helpers/variables";
@import "helpers/mixins";
@import "helpers/icons";
@import "helpers/animations";
@import "modules/variables";
@import "modules/mixins";
@import "modules/icons";
@import "modules/animations";
//
// Libraries: Code by Other Homies
// Libraries: Code by other Homies
// --------------------------------------------------
@import "../../../../bower_components/normalize-scss/_normalize"; // via Bower
@import "lib/nprogress";
@import "lib/codemirror";
@import "lib/nanoscroller";
@import "vendor/nprogress";
@import "vendor/codemirror";
@import "vendor/nanoscroller";
//