SU-SWS/decanter

View on GitHub
core/src/scss/utilities/functions/breakpoint/_breakpoint-next.scss

Summary

Maintainability
Test Coverage

///
/// breakpoint-next($name, $breakpoint-names)
///
/// The $su-grid-screens map defined in the grid variables file is used as the
/// $breakpoints argument by default.
///
/// Name of the next breakpoint, or null for the last breakpoint.
///
/// breakpoint-next(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, 2xl: 1500px))
/// Returns "md"
///
/// @group mixin
@function breakpoint-next($name, $breakpoints: map-keys($su-grid-screens)) {
  $n: index($breakpoints, $name);
  @if is-integer($n) {
    @return if($n < length($breakpoints), nth($breakpoints, $n + 1), null);
  }
  @else {
    @error "Could not find breakpoint shortcode in breakpoint-next mixin";
  }
}