Skip to content

Conversation

britt6612
Copy link
Collaborator

What does this PR do?

fixes bug when using border=between and gap with a pixel value

Where should the reviewer start?

styledBox.js

What testing has been done on this PR?

wrote a test and storybook

How should this be manually tested?

storybook

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • userEvent is used in place of fireEvent.
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

In the If statement for border="between" it uses responsive metric to define responsiveBorderMetric` which is undefined when a user passes a pixel value.

What are the relevant issues?

closes #6485

Screenshots (if appropriate)

no

Do the grommet docs need to be updated?

no

Should this PR be mentioned in the release notes?

no

Is this change backwards compatible or is it a breaking change?

backwards compatible

@britt6612 britt6612 requested a review from jcfilben November 14, 2022 01:00
Comment on lines +292 to 294
parseMetricToNum(responsiveMetric || metric) / 2 -
parseMetricToNum(responsiveBorderMetric) / 2
}px`;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this will break spacing if any non-px metric is passed, as 'px' is forcefully appended to the parsed number. But this is a more basic flaw in the border between implementation. I wonder if it makes sense to address it separately?

Copy link
Collaborator Author

@britt6612 britt6612 Nov 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shb Im not sure what you mean by passing a non-px value? Are you referring to the t-shirt sizing we have like small medium? Can you give me an example case where it isn’t working so I can see what you are trying to pass through?

Copy link
Collaborator Author

@britt6612 britt6612 Nov 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shb I see the issue sorry it didn't click earlier so if someone passes 5em the borderOffSet will not be correct because it is assuming px values. Alot of the math would also not be correct considering the borderMetric used to calculate the borderOffSet is in px Im thinking this may take some time in converting some of the values. Im inclined to open a separate issue to look into all of the values that would need to change and how we want to address this.
@jcfilben @ericsoderberghp

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think we can handle as a separate issue

britt6612 and others added 2 commits November 15, 2022 10:03
Co-authored-by: Jessica Filben <54560994+jcfilben@users.noreply.github.com>
@britt6612 britt6612 requested a review from jcfilben November 15, 2022 17:29
Copy link
Collaborator

@jcfilben jcfilben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

britt6612 and others added 2 commits November 15, 2022 15:31
Co-authored-by: Eric Soderberg <eric.soderberg@hpe.com>
@britt6612
Copy link
Collaborator Author

linking new issue for non pixel values being passed to gap
#6497

@ericsoderberghp ericsoderberghp merged commit 1478b4b into grommet:master Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Box breaks when using border="between" and a gap size in pixels
4 participants