_utilities.spacings.scss 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* ==========================================================================
  2. #SPACINGS
  3. ========================================================================== */
  4. /**
  5. * Utility classes to put specific spacing values onto elements. The below loop
  6. * will generate us a suite of classes like:
  7. *
  8. * .u-margin-top {}
  9. * .u-padding-left-large {}
  10. * .u-margin-right-small {}
  11. * .u-padding {}
  12. * .u-padding-right-none {}
  13. * .u-padding-horizontal {}
  14. * .u-padding-vertical-small {}
  15. */
  16. $inuit-spacing-directions: (
  17. null: null,
  18. "-top": "-top",
  19. "-right": "-right",
  20. "-bottom": "-bottom",
  21. "-left": "-left",
  22. "-horizontal": "-left" "-right",
  23. "-vertical": "-top" "-bottom",
  24. ) !default;
  25. $inuit-spacing-properties: (
  26. "padding": "padding",
  27. "margin": "margin",
  28. ) !default;
  29. $inuit-spacing-sizes: (
  30. null: $inuit-global-spacing-unit,
  31. "-tiny": $inuit-global-spacing-unit-tiny,
  32. "-small": $inuit-global-spacing-unit-small,
  33. "-large": $inuit-global-spacing-unit-large,
  34. "-huge": $inuit-global-spacing-unit-huge,
  35. "-none": 0
  36. ) !default;
  37. @each $property-namespace, $property in $inuit-spacing-properties {
  38. @each $direction-namespace, $direction-rules in $inuit-spacing-directions {
  39. @each $size-namespace, $size in $inuit-spacing-sizes {
  40. .u-#{$property-namespace}#{$direction-namespace}#{$size-namespace} {
  41. @each $direction in $direction-rules {
  42. #{$property}#{$direction}: $size !important;
  43. }
  44. }
  45. }
  46. }
  47. }