Ghost/core/client/assets/sass/helpers/mixins.scss
Paul Adam Davis 7782c48383 Swap out Ruby Sass for Node Sass
- Uses Node Bourbon https://www.npmjs.org/package/node-bourbon
- Produces source maps
- Removed all ruby dependencie

History:
- Remove bourbon from package and cleanup grunt tasks
- Un-bourbon keyframe animations
- Un-bourbon transitions
- Un-bourbon box-sizing
- Un-bourbon font-feature-settings
- Import bourbon clearfix mixin
- Un-bourbon linear gradients
- Un-bourbon input types
- Un-bourbon positions
- Un-bourbon transforms
- Un-bourbon notification animations
- Un-bourbon uploader box-sizing
- Un-bourbon border-radius
- Un-bourbon splitbutton transitions
- Add triangle mixin
- Un-bourbon default container positioning
- Un-bourbon flexbox properties
- Fix triangle mixin - It now has the same output as the Bourbon mixin
- Add autoprefixer
- Correct global default font size
- Remove unwanted prefixes - Because, y'know, autoprefixer
- Output from node sass migration - Includes all the files we usually have, plus source maps
2014-08-30 14:13:36 +01:00

149 lines
4.0 KiB
SCSS

//
// 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") {
$size: $size / 2;
width: 0;
height: 0;
@if $direction == "down" {
border-left: $size solid #{setTriangleColor($direction, "left", $color)};
border-right: $size solid #{setTriangleColor($direction, "right", $color)};
border-top: $size 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: $size solid #{setTriangleColor($direction, "bottom", $color)};
}
@if $direction == "left" {
border-right: $size 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: $size 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";
}
}