publik-base-theme/static/includes/_utils.scss

144 lines
2.6 KiB
SCSS

$white: #ffffff !default;
$black: #000000 !default;
@font-face {
font-family: 'FontAwesome';
src: url('/static/xstatic/fonts/fontawesome-webfont.woff2') format('woff2'),
url('/static/xstatic/fonts/fontawesome-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@mixin vendor-prefix($name, $value) {
@each $vendor in ('-webkit-', '-moz-', '-ms-', '-o-', '') {
#{$vendor}#{$name}: #{$value};
}
}
@function text-color($color) {
@if (lightness($color) > 50) {
@return $black;
} @else {
@return $white;
}
}
@function extract-color($border){
@each $part in $border { @if type-of($part) == color { @return $part; } }
@return transparent;
}
@function extract-width($border){
@each $part in $border {
@if type-of($part) == number { @return $part; } }
@return 0;
}
@function extract-top($spacing){
@return nth($spacing, 1);
}
@function extract-right($spacing){
@if (length($spacing) == 1) {
@return nth($spacing, 1);
}
@if (length($spacing) == 2) {
@return nth($spacing, 2);
}
@if (length($spacing) == 4) {
@return nth($spacing, 2);
}
@error "Invalid spacing #{spacing}";
}
@function extract-bottom($spacing){
@if (length($spacing) == 1) {
@return nth($spacing, 1);
}
@if (length($spacing) == 2) {
@return nth($spacing, 1);
}
@if (length($spacing) == 4) {
@return nth($spacing, 3);
}
@error "Invalid spacing #{spacing}";
}
@function extract-left($spacing){
@if (length($spacing) == 1) {
@return nth($spacing, 1);
}
@if (length($spacing) == 2) {
@return nth($spacing, 2);
}
@if (length($spacing) == 4) {
@return nth($spacing, 4);
}
@error "Invalid spacing #{spacing}";
}
// Check if value is a number > 0;
@function is-positive-number($value) {
@return type-of($value) == 'number' and $value > 0;
}
// Define desktop media queries depending of unit
@function min-desktop-viewport($limit) {
$unit: unit($limit);
@if ($unit == "em" or $unit == "rem") {
@return $limit + 0.01;
} @else {
@return $limit + 1;
}
}
// Only display content to screen readers
@mixin sr-only {
position: absolute !important;
width: 1px !important;
height: 1px !important;
padding: 0 !important;
margin: -1px !important;
overflow: hidden !important;
clip: rect(0, 0, 0, 0) !important;
white-space: nowrap !important;
border: 0 !important;
}
.sr-only {
@include sr-only();
}
// clearifx
@mixin clearfix {
&::after {
display: block;
clear: both;
content: "";
}
@supports (display: flow-root) {
display: flow-root;
&::after {
content: none;
}
}
}
.clearfix {
@include clearfix();
}
// hidden
[hidden] {
display: none !important;
}