-
Notifications
You must be signed in to change notification settings - Fork 5
Rewrite CSS margin and nospace mixins to use logical properties #13
Conversation
test/sass/mixins--spacing.spec.scss
Outdated
} | ||
} | ||
|
||
@include it("Ignores more than two values in the sizes list for the dimension 'inline'") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes me think it might be better to have more explicit mixins rather than having arguments that change what they do (eg @include margin-inline(16, 32)
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the point, but not sure it's the right thing to do here: I'd rather have just one way of setting margins, at least to start off with. Using @stephenwf's idea of throwing errors when there are an incorrect number of values passed will supply rapid developer feedback, preventing the silent fail which this code currently allows.
$firstValue: nth($size_in_px, 1); | ||
$secondValue: nth($size_in_px, 2); | ||
$firstValue: nth($size-in-px, 1); | ||
$secondValue: nth($size-in-px, 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could @error
here if there is a 3rd parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no way of catching sass errors afaik, so we wouldn't be able to have a test that checked correct error-throwing behaviour. I think it's worth doing anyway though, good call.
Doesn't yet work correctly when more than one value in the list for the first argument, when no dimension supplied. |
(includes refactor for clarity)
|
Hmm... No way of setting just top or just bottom spacing at the moment, due to uncertainty of the vertical writing mode / |
Did you see oddbird/true#92 (comment)? |
@thewilkybarkid Hadn't seen that, cheers! |
This means they won't break. Still need to add tests, and consider renaming
padding
mixin into internal_spacing
mixin._padding-left
and_padding-right
mixins to be_spacing-left
and_spacing-right
, respectively, in order to support bothpadding
andmargin
.padding
mixin to be a thin wrapper calling_spacing
with the$space-type
ofpadding
.margin
mixin and implement using_spacing
with the$space-type
ofmargin
.Note: as we're not supporting vertical writing modes yet,
block-start
always setstop
, andblock-end
always setsbottom
.