Skip to content
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

Image component refactor #627

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

joshfarrant
Copy link
Contributor

@joshfarrant joshfarrant commented Jun 25, 2024

Summary

Refactor Image component to simplify its API, improve maintainability, and reduce the number of edge-cases due to conflicting props.

List of notable changes:

  • Fixed the border radius of the Card.Image component. It was previously possible for the div that wraps the image and the image itself to have different border radii (that's not a word I get to write often).
  • Removed the as, media, and sources props, as well code paths which render a <picture> element. This element added complexity to the implementation without providing any real benefit over a native HTML approach. If a user wants to use a <picture> element with the updated Image component, they can simply use the <picture> element directly, for example:
  <picture>
    <source srcSet="..." media="..." />
    <Image src="..." alt="..." />
  </picture>

What should reviewers focus on?

  • Ensure that there are no visual regressions on components which use the Image component
  • Ensure that any components which relied on now removed props (aspectRatio, as, media, and sources) are updated to use the new API
  • Ensure that the Card.Image component is still styled correctly after the changes

Supporting resources (related issues, external links, etc):

Contributor checklist:

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • New visual snapshots have been generated / updated for any UI changes
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist:

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there aren't other open Pull Requests for the same update/change

Screenshots:

Please try to provide before and after screenshots or videos

Before After

Copy link

changeset-bot bot commented Jun 25, 2024

🦋 Changeset detected

Latest commit: 0b4584e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@primer/react-brand Minor
@primer/brand-primitives Minor
@primer/brand-e2e Minor
@primer/brand-fonts Minor
@primer/brand-config Minor
@primer/brand-storybook Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Jun 25, 2024

🟢 No design token changes found

Copy link
Contributor

github-actions bot commented Jun 25, 2024

⚠️ Visual differences found

Our visual comparison tests found UI differences.

Please review the differences by using the test artifacts to ensure that the changes were intentional.

Artifacts can be downloaded and reviewed locally.

Download links are available at the bottom of the workflow summary screen.

Example:

artifacts section of workflow run

If the changes are expected, please run npm run test:visual:update-snapshots to replace the previous fixtures.

Review visual differences

@joshfarrant joshfarrant force-pushed the joshfarrant/image-height-fix branch from e20b2e2 to 9a01a13 Compare June 27, 2024 12:57
@joshfarrant joshfarrant force-pushed the joshfarrant/image-height-fix branch from debaa83 to 552132e Compare July 2, 2024 11:22
@joshfarrant joshfarrant force-pushed the joshfarrant/image-height-fix branch from 552132e to 8269ca3 Compare July 10, 2024 14:17
@joshfarrant joshfarrant force-pushed the joshfarrant/image-height-fix branch from 4117c97 to 89b1028 Compare July 17, 2024 07:22
@joshfarrant joshfarrant force-pushed the joshfarrant/image-height-fix branch from b3e748f to 0b4584e Compare August 5, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant