_functions.breakpoints.scss 1.0 KB

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