2
0

_functions.breakpoints.scss 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. @use 'sass:list';
  2. @use 'sass:map';
  3. @use '../settings' as *;
  4. // Based upon the fine work and thoughts from Bootstrap v4.
  5. // Copyright 2011-2018 The Bootstrap Authors
  6. // Copyright 2011-2018 Twitter, Inc.
  7. // Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  8. // Name of the next breakpoint, or null for the last breakpoint.
  9. // >> breakpoint-next(sm)
  10. // md
  11. @function breakpoint-next($name) {
  12. $breakpoint-names: map.keys($breakpoints);
  13. $n: list.index($breakpoint-names, $name);
  14. @return if(
  15. $n < list.length($breakpoint-names),
  16. list.nth($breakpoint-names, $n + 1),
  17. null
  18. );
  19. }
  20. // Minimum breakpoint width. Null for the smallest (first) breakpoint.
  21. // >> breakpoint-min(sm)
  22. // 50em
  23. @function breakpoint-min($name) {
  24. $min: map.get($breakpoints, $name);
  25. @return if($min != 0, $min, null);
  26. }
  27. // Maximum breakpoint width. Null for the largest (last) breakpoint.
  28. // >> breakpoint-max(sm)
  29. // 56.1875em
  30. @function breakpoint-max($name) {
  31. $next: breakpoint-next($name);
  32. @return if($next, breakpoint-min($next) - 0.0625em, null);
  33. }