Last active
January 2, 2021 19:06
-
-
Save unicornware/3dde96af38a9fdb1c933c0a8a28916af to your computer and use it in GitHub Desktop.
Sass Mixin - Utility classes for removing the margin or padding from the first or last element within a container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// ---------------------------------------------------------------------------- | |
| /// @name spacing-utils-first-last | |
| /// @group mixins | |
| /// ---------------------------------------------------------------------------- | |
| /// Generates utility classes for removing the margin or padding from the first | |
| /// or last element within a container. | |
| /// @require {function} breakpoint-infix | |
| /// @require {mixin} breakpoint-up | |
| /// @require {variable} $grid-breakpoints | |
| /// @require {variable} $spacers | |
| @mixin spacing-utils-first-last { | |
| @each $pos in (first, last) { | |
| @each $abbr, $value in (m: margin, p: padding) { | |
| @each $direction, $dir in (b: bottom, l: left, r: right, t: top) { | |
| @each $breakpoint in map-keys($grid-breakpoints) { | |
| @include breakpoint-up($breakpoint) { | |
| $infix: breakpoint-infix($breakpoint, $grid-breakpoints); | |
| .#{$infix}#{$abbr}#{$direction}-0 { | |
| &-#{$pos} > *:#{$pos}-child { | |
| #{$value}-#{$dir}: map-get($spacers, 0) !important; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment