owid / owid-grapher

A platform for creating interactive data visualizations
https://ourworldindata.org
MIT License
1.39k stars 229 forks source link

Add an option to columns in archie to set their vertical margins to 0 #3014

Open ikesau opened 10 months ago

ikesau commented 10 months ago

We sometimes use sticky-right / sticky-left / side-by-side columns within the flow of other content. Their default top and bottom margins are too large in these cases.

image

Continually adding high specificity overrides for each specific usecase is annoying and not easily remembered. It would be nicer if there was simply an option in the archie that could remove the margins if you needed to.

e.g.

{.sticky-right}
margins: false
[.+left]
[]
[.+right]
[]
{}
mlbrgl commented 9 months ago

@ikesau I could see a potential for a more generic override system, maybe based on utility classes convention, e.g:

{.sticky-right}
css: margin-top-0 margin-bottom-0
[.+left]
[]
[.+right]
[]
{}

Or more likely, these class overrides should be only allowed and scoped on a case-by-case basis, so that we don't have to support a growing number of combinations that would eventually result in a fragmented design.

cc @danyx23 triaged

ikesau commented 9 months ago

Thinking about this a little more, I think if we ever want to invest some effort here it would be better to implement it in our presentation layer to prevent styling logic leaking into archie.

i.e. a single file that's responsible for margin overrides, either via SCSS or JS, that is able to define all these exceptions.

This would allow us to robustly solve the problem from a single place instead of introducing another arbitrary area of complexity for bugs to arrive through.