208 lines
4.4 KiB
SCSS
208 lines
4.4 KiB
SCSS
|
@mixin themify($themes) {
|
||
|
@each $theme, $map in $themes {
|
||
|
.theme__#{$theme} & {
|
||
|
$theme-map: () !global;
|
||
|
@each $key, $submap in $map {
|
||
|
$value: map-get(map-get($themes, $theme), "#{$key}");
|
||
|
$theme-map: map-merge(
|
||
|
$theme-map,
|
||
|
(
|
||
|
$key: $value
|
||
|
)
|
||
|
) !global;
|
||
|
}
|
||
|
@content;
|
||
|
$theme-map: null !global;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin respond-to($breakpoint) {
|
||
|
// If the key exists in the map
|
||
|
@if map-has-key($breakpoints, $breakpoint) {
|
||
|
// Prints a media query based on the value
|
||
|
@media (max-width: map-get($breakpoints, $breakpoint)) {
|
||
|
@content;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin pseudo($display: block, $pos: absolute, $content: "") {
|
||
|
content: $content;
|
||
|
display: $display;
|
||
|
position: $pos;
|
||
|
}
|
||
|
|
||
|
@mixin responsive-ratio($x, $y, $pseudo: false) {
|
||
|
$padding: unquote(($y / $x) * 100 + "%");
|
||
|
@if $pseudo {
|
||
|
&:before {
|
||
|
@include pseudo($pos: relative);
|
||
|
width: 100%;
|
||
|
padding-top: $padding;
|
||
|
}
|
||
|
} @else {
|
||
|
padding-top: $padding;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin css-triangle($color, $direction, $size: 6px, $position: absolute, $round: false) {
|
||
|
@include pseudo($pos: $position);
|
||
|
width: 0;
|
||
|
height: 0;
|
||
|
@if $round {
|
||
|
border-radius: 3px;
|
||
|
}
|
||
|
@if $direction == down {
|
||
|
border-left: $size solid transparent;
|
||
|
border-right: $size solid transparent;
|
||
|
border-top: $size solid $color;
|
||
|
margin-top: 0 - round($size / 2.5);
|
||
|
} @else if $direction == up {
|
||
|
border-left: $size solid transparent;
|
||
|
border-right: $size solid transparent;
|
||
|
border-bottom: $size solid $color;
|
||
|
margin-bottom: 0 - round($size / 2.5);
|
||
|
} @else if $direction == right {
|
||
|
border-top: $size solid transparent;
|
||
|
border-bottom: $size solid transparent;
|
||
|
border-left: $size solid $color;
|
||
|
margin-right: -$size;
|
||
|
} @else if $direction == left {
|
||
|
border-top: $size solid transparent;
|
||
|
border-bottom: $size solid transparent;
|
||
|
border-right: $size solid $color;
|
||
|
margin-left: -$size;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin font-source-sans($size: false, $colour: false, $weight: false, $lh: false) {
|
||
|
font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;
|
||
|
@if $size {
|
||
|
font-size: $size;
|
||
|
}
|
||
|
@if $colour {
|
||
|
color: $colour;
|
||
|
}
|
||
|
@if $weight {
|
||
|
font-weight: $weight;
|
||
|
}
|
||
|
@if $lh {
|
||
|
line-height: $lh;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin input-placeholder {
|
||
|
&.placeholder {
|
||
|
@content;
|
||
|
}
|
||
|
&:-moz-placeholder {
|
||
|
@content;
|
||
|
}
|
||
|
&::-moz-placeholder {
|
||
|
@content;
|
||
|
}
|
||
|
&:-ms-input-placeholder {
|
||
|
@content;
|
||
|
}
|
||
|
&::-webkit-input-placeholder {
|
||
|
@content;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin truncate($truncation-boundary) {
|
||
|
max-width: $truncation-boundary;
|
||
|
white-space: nowrap;
|
||
|
overflow: hidden;
|
||
|
text-overflow: ellipsis;
|
||
|
}
|
||
|
|
||
|
@mixin box-shadow($top, $left, $blur, $size, $color, $inset: false) {
|
||
|
@if $inset {
|
||
|
-webkit-box-shadow: inset $top $left $blur $size $color;
|
||
|
-moz-box-shadow: inset $top $left $blur $size $color;
|
||
|
box-shadow: inset $top $left $blur $size $color;
|
||
|
} @else {
|
||
|
-webkit-box-shadow: $top $left $blur $size $color;
|
||
|
-moz-box-shadow: $top $left $blur $size $color;
|
||
|
box-shadow: $top $left $blur $size $color;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin on-event($self: false) {
|
||
|
@if $self {
|
||
|
&,
|
||
|
&:hover,
|
||
|
&:active,
|
||
|
&:focus {
|
||
|
@content;
|
||
|
}
|
||
|
} @else {
|
||
|
&:hover,
|
||
|
&:active,
|
||
|
&:focus {
|
||
|
@content;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin transition($what: all, $time: 0.2s, $how: ease-in-out) {
|
||
|
-webkit-transition: $what $time $how;
|
||
|
-moz-transition: $what $time $how;
|
||
|
-ms-transition: $what $time $how;
|
||
|
-o-transition: $what $time $how;
|
||
|
transition: $what $time $how;
|
||
|
}
|
||
|
|
||
|
// Browser Prefixes
|
||
|
@mixin transform($transforms) {
|
||
|
-webkit-transform: $transforms;
|
||
|
-moz-transform: $transforms;
|
||
|
-ms-transform: $transforms;
|
||
|
transform: $transforms;
|
||
|
}
|
||
|
|
||
|
// Rotate
|
||
|
@mixin rotate($deg) {
|
||
|
@include transform(rotate(#{$deg}deg));
|
||
|
}
|
||
|
|
||
|
// Scale
|
||
|
@mixin scale($scale) {
|
||
|
@include transform(scale($scale));
|
||
|
}
|
||
|
|
||
|
@mixin scaleX($scale) {
|
||
|
@include transform(scaleX($scale));
|
||
|
}
|
||
|
|
||
|
@mixin scaleY($scale) {
|
||
|
@include transform(scaleY($scale));
|
||
|
}
|
||
|
|
||
|
// Translate
|
||
|
@mixin translate($x, $y) {
|
||
|
@include transform(translate($x, $y));
|
||
|
}
|
||
|
|
||
|
@mixin translateX($x) {
|
||
|
@include transform(translateX($x));
|
||
|
}
|
||
|
|
||
|
@mixin translateY($y) {
|
||
|
@include transform(translateY($y));
|
||
|
}
|
||
|
|
||
|
// Skew
|
||
|
@mixin skew($x, $y) {
|
||
|
@include transform(skew(#{$x}deg, #{$y}deg));
|
||
|
}
|
||
|
|
||
|
// Transform Origin
|
||
|
@mixin transform-origin($origin) {
|
||
|
-webkit-transform-origin: $origin;
|
||
|
-moz-transform-origin: $origin;
|
||
|
-ms-transform-origin: $origin;
|
||
|
transform-origin: $origin;
|
||
|
}
|