media functions, navbar utilities

This commit is contained in:
codecalm
2020-02-01 23:38:42 +01:00
parent 5c181d858c
commit 1f3c088e79
6 changed files with 122 additions and 26 deletions
+26
View File
@@ -18,3 +18,29 @@
@return $string;
}
@mixin media-breakpoint-down-than($name, $breakpoints: $grid-breakpoints) {
$prev: breakpoint-prev($name);
@if $prev == null {
@content;
} @else {
$max: breakpoint-max($prev, $breakpoints);
@if $max {
@media (max-width: $max) {
@content;
}
} @else {
@content;
}
}
}
@function breakpoint-prev($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {
$n: index($breakpoint-names, $name);
@if not $n {
@error "breakpoint `#{$name}` not found in `#{$breakpoints}`";
}
@return if($n > 1, nth($breakpoint-names, $n - 1), null);
}