spacing.sass 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. .is-marginless
  2. margin: 0 !important
  3. .is-paddingless
  4. padding: 0 !important
  5. $spacing-shortcuts: ("margin": "m", "padding": "p") !default
  6. $spacing-directions: ("top": "t", "right": "r", "bottom": "b", "left": "l") !default
  7. $spacing-horizontal: "x" !default
  8. $spacing-vertical: "y" !default
  9. $spacing-values: ("0": 0, "1": 0.25rem, "2": 0.5rem, "3": 0.75rem, "4": 1rem, "5": 1.5rem, "6": 3rem) !default
  10. @each $property, $shortcut in $spacing-shortcuts
  11. @each $name, $value in $spacing-values
  12. // All directions
  13. .#{$shortcut}-#{$name}
  14. #{$property}: $value !important
  15. // Cardinal directions
  16. @each $direction, $suffix in $spacing-directions
  17. .#{$shortcut}#{$suffix}-#{$name}
  18. #{$property}-#{$direction}: $value !important
  19. // Horizontal axis
  20. @if $spacing-horizontal != null
  21. .#{$shortcut}#{$spacing-horizontal}-#{$name}
  22. #{$property}-left: $value !important
  23. #{$property}-right: $value !important
  24. // Vertical axis
  25. @if $spacing-vertical != null
  26. .#{$shortcut}#{$spacing-vertical}-#{$name}
  27. #{$property}-top: $value !important
  28. #{$property}-bottom: $value !important