SU-SWS/decanter

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

Summary

Maintainability
Test Coverage

///
/// The $su-grid-screens map defined in the grid variables file is used as the
/// $breakpoints argument by default.
///
/// Maximum breakpoint width. Null for the largest (2xl) breakpoint.
/// The maximum value is calculated as the minimum of the following breakpoint
/// minus 1px.
///
/// @name breakpoint-max
///
/// @param {String} $name the key in the breakpoint map. eg: sm
/// @param {Map} $breakpoints [$su-grid-screens] The breakpoint map
///
/// @example
/// breakpoint-max(sm)
/// Returns "767px"
///
/// @group mixin
@function breakpoint-max($name, $breakpoints: $su-grid-screens) {
  $next: breakpoint-next($name, map-keys($breakpoints));
  @return if($next, breakpoint-min($next, $breakpoints) - 1px, null);
}