shared-components icon indicating copy to clipboard operation
shared-components copied to clipboard

Extend `spacing` to all components

Open a-type opened this issue 7 years ago • 3 comments

Seems like a good idea to convert all current component outer margins to use the spacing prop for customization. That allows us to slowly phase out use of the Spacing component, which is not ideal because it adds an extra <div> to the page structure.

Ideally, this rollout would not break anything, as we'd specify default spacing values which are equivalent to current margin values on each outer component.

a-type avatar May 09 '18 14:05 a-type

As a part of implementing spacing on new components, we want to make sure that we only use negative margins for text components. For all other components, we can use userTextSpacing.withLineHeight(0) to provide the same options while having normal margins.

zacklitzsinger avatar May 17 '18 19:05 zacklitzsinger

Yeah, or possibly something a bit more idiomatic. userTextSpacing was named with text specifically to avoid confusion on that point. We could either create a separate userSpacing (which would be a pretty trivial helper), or rename and extend the existing stuff (possibly rename to userSpacing.text to combine both approaches).

a-type avatar May 18 '18 15:05 a-type

I think some simple renaming could work, plus exposing a function that specifically invokes the function such that we end up with no margins so that you don't have to know a trick to do this.

zacklitzsinger avatar May 18 '18 15:05 zacklitzsinger