Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Add support for row gutters #319

Merged
merged 2 commits into from
Dec 4, 2017
Merged

Add support for row gutters #319

merged 2 commits into from
Dec 4, 2017

Conversation

exogen
Copy link
Contributor

@exogen exogen commented Dec 1, 2017

Per FormidableLabs/victory#862, the docs currently state that:

When orientation is horizontal, gutters are between columns. When orientation is vertical, gutters are the space between rows.

This is a simple change to make, but when I did so, the result was not great:

screen shot 2017-12-01 at 1 38 05 pm

And given that we support multiple itemsPerRow, even if the docs were correct there'd still be a desire to specify column and row gutters independently.

In fact all of the vertical <VictoryLegend> demos are relying on the fact that gutter only applies horizontally – they are not assuming that the docs are correct. If we made this change to match the docs, it would be a real pain for everyone using Victory to upgrade, because their chart layouts would likely be broken.

So this PR takes a different approach: when gutter is a number, it still only refers to the column gutter, no matter the orientation. But it adds support for gutter being an object like { column: 50, row: 25 }. We can update the docs to reflect this.

Details regarding the object shape can be fleshed out here (should it be { horizontal, vertical }? { top, bottom, left, right }?), but I think this general approach is the way to go.

/cc @boygirl @ebrillhart @tacomanator

@ebrillhart
Copy link
Contributor

This approach makes a lot of sense to me - top/bottom/left/right would be kind of great if there was also support for horizontal/vertical. I think both of those could be pretty common use cases and it allows for more user control.

@exogen
Copy link
Contributor Author

exogen commented Dec 1, 2017

@ebrillhart I agree top/bottom/left/right would be really nice! The only issue I have is that it's more complicated to implement than what's in this PR, because I'd need to figure out how to shift each item's top and left too. I'm interested to hear if @boygirl thinks such precise gutter control makes sense (does specifying a different number on each individual side even still count as a "gutter"? I'm not sure).

@boygirl
Copy link
Contributor

boygirl commented Dec 1, 2017

@exogen I like that you've made this a non-breaking change, but I think it's confusing to have a gutter as a single number only apply to columns. Maybe gutter => columnGutter and add rowGutter? @exogen How much work do you think it would be to get top/bottom/left/right control working? I agree that would be nice to have.

@exogen
Copy link
Contributor Author

exogen commented Dec 1, 2017

@boygirl I'll take a shot at it now to see how difficult it is!

re: gutter: Number only applying to columns, I'm comforted by the fact that "gutter" is conventionally only a term for column gutters in page layout anyway, so there's precedent :)

If we switched to columnGutter / rowGutter, what would an upgrade path look like? add a deprecation warning for gutter?

@boygirl
Copy link
Contributor

boygirl commented Dec 1, 2017

@exogen in that case, what about gutter and rowGutter? No breaking changes, and less potential for confusion.

@exogen
Copy link
Contributor Author

exogen commented Dec 1, 2017

@boygirl Sounds good to me! I'll make that change and then continue exploring top/bottom/left/right.

@boygirl
Copy link
Contributor

boygirl commented Dec 2, 2017

Perfect!

@boygirl boygirl merged commit 0b85957 into master Dec 4, 2017
@boygirl boygirl deleted the feat/row-gutter branch December 4, 2017 21:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants