1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-02 01:42:36 +02:00

Simplify generation and get rid of previously added "breakpoint-previous" function

This commit is contained in:
Pierre-Denis Vanduynslager
2017-01-14 00:33:21 -05:00
committed by Mark Otto
parent c1325a756e
commit 89b47efc32
2 changed files with 5 additions and 18 deletions

View File

@@ -16,22 +16,9 @@
// md
@function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {
$n: index($breakpoint-names, $name);
@return if($n, if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null), null);
@return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);
}
// Name of the previous breakpoint, or null for the first breakpoint.
//
// >> breakpoint-previous(sm)
// xs
// >> breakpoint-next(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
// xs
// >> breakpoint-next(sm, $breakpoint-names: (xs sm md lg xl))
// xs
@function breakpoint-previous($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {
$n: index($breakpoint-names, $name);
@return if($n != 1, nth($breakpoint-names, $n - 1), null);
};
// Minimum breakpoint width. Null for the smallest (first) breakpoint.
//
// >> breakpoint-min(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))