-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename dimensions to containerBounds #1757
base: main
Are you sure you want to change the base?
Conversation
size-limit report 📦
|
b3a3234
to
abe7fab
Compare
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.
Are the height and width of containerBounds
and chartBounds
sometimes different? If they are the same, I am wondering if we can just have height and width associated with one of them, to avoid confusion.
Also just going back to the original problem:
We're using dimensions and bounds all over the repo, but along the way sometimes a bounds prop will only contain dimensions and vice versa.
Would it possibly make sense to just ensure that one prop always has all the dimensions we are looking for, rather than having two props that are similar?
packages/polaris-viz/src/components/LegendContainer/components/HiddenLegendTooltip.tsx
Outdated
Show resolved
Hide resolved
const {legend, setLegendDimensions, height, width} = useLegend({ | ||
data: [ | ||
{ | ||
shape: 'Line', | ||
series: data, | ||
}, | ||
], | ||
dimensions, | ||
dimensions: containerDimensions, |
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.
This line used to be dimensions and so did line 261, so I am a bit confused why they are replaced with different variables, not the same one. Is this intentional? Were we using the wrong variable before?
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.
This is intentional. This was using the original dimensions
prop that was actually bounds.
Now containerDimensions
only passes height
and width
.
abe7fab
to
fbede42
Compare
The
|
What does this implement/fix?
Note
I'd like to merge this before #1755 & #1756
We're using
dimensions
andbounds
all over the repo, but along the way sometimes abounds
prop will only contain dimensions and vice versa.This PR renames the
dimension
prop tocontainerBounds
so we can easily distinguish between what's a container value and whats a chart value.In this example, the red bounds are considered
containerBounds
. This gives us theheight
andwidth
as well as thex/y
position of the container on the page.We also have a concept of
chartBounds
, which is theheight/width/x/y
of the red outline. This is the bounds of the chart itself relative to the container.What do the changes look like?
There should be no visual changes.
Storybook link
https://6062ad4a2d14cd0021539c1b-kjvrjvketz.chromatic.com/
Before merging
Check your changes on a variety of browsers and devices.
Update the Changelog's Unreleased section with your changes.
Update relevant documentation, tests, and Storybook.
Make sure you're exporting any new shared Components, Types and Utilities from the top level index file of the package