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

Apply opinionated defaults to LogoSuite #691

Merged
merged 22 commits into from
Aug 20, 2024

Conversation

joshfarrant
Copy link
Contributor

@joshfarrant joshfarrant commented Aug 12, 2024

List of notable changes:

  • Added new default variant to LogoSuite which:
    • Applies emphasis styles if there are 5 or fewer logos
    • Applied muted styles if there are 6 or more logos
  • Reduced logo size on mobile
  • Removed unnecessary (and technically unsupported) Fragments from LogoSuite Stories
  • Tidied up LogoSuite stories
  • Don't actively encourage stacking LogoSuite components in docs or Storybook
  • Prefer examples with visually-hidden headings

What should reviewers focus on?

  • Make sure you're happy with the regenerated snapshots
  • Does the functionality of the new default variant make sense and is it communicated appropriately in the docs?

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:

Before After

image

image

Copy link

changeset-bot bot commented Aug 12, 2024

🦋 Changeset detected

Latest commit: bccd348

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

This PR includes changesets to release 6 packages
Name Type
@primer/brand-primitives Minor
@primer/react-brand 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 Aug 12, 2024

🟢 No design token changes found

Copy link
Contributor

github-actions bot commented Aug 12, 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/logosuite-opinionated-defaults branch from 542720e to 2dc38b1 Compare August 12, 2024 14:15
@joshfarrant joshfarrant force-pushed the joshfarrant/logosuite-opinionated-defaults branch from df67e35 to 8a104a7 Compare August 13, 2024 13:17
@joshfarrant joshfarrant force-pushed the joshfarrant/logosuite-opinionated-defaults branch from 8a104a7 to f9f78e2 Compare August 13, 2024 13:50
@joshfarrant joshfarrant force-pushed the joshfarrant/logosuite-opinionated-defaults branch from dc2e302 to d52f1ac Compare August 13, 2024 14:30
@joshfarrant joshfarrant force-pushed the joshfarrant/logosuite-opinionated-defaults branch from d52f1ac to 16e71e1 Compare August 13, 2024 15:07
@joshfarrant joshfarrant marked this pull request as ready for review August 14, 2024 07:22
@joshfarrant joshfarrant changed the title Joshfarrant/logosuite opinionated defaults Apply opinionated defaults to LogoSuite Aug 14, 2024
@joshfarrant joshfarrant force-pushed the joshfarrant/logosuite-opinionated-defaults branch from 91d4884 to c42c1e1 Compare August 14, 2024 07:53
'@primer/react-brand': minor
---

⚠️ This update contains a breaking change.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the breaking change still valid following recent changes? If it is, could we be more specific about whether it's a visual one vs API? Guessing it's the former, in which case we should give the user a nudge about what to look for.

Example you can reference from another recent change: https://github.com/primer/brand/pull/616/files#diff-bf4a5c10ff09f2964e747a5873b4c1b2124a813202d314f69effbc3de1faf3dfR7-R8

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the changeset, let me know what you think 👍

Comment on lines +7 to +10
type StoryProps = Required<
Pick<LogoSuiteProps, 'align' | 'hasDivider'> &
Pick<LogoSuiteHeadingProps, 'visuallyHidden'> &
Pick<LogoSuiteLogoBarProps, 'marquee' | 'marqueeSpeed' | 'variant'>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is cool, better than what's currently here so let's go with it 👍

Leaving some additional thoughts for posterity too, so we can come back to use of Omit vs Pick.

I could be reading this wrong, but when adding a new prop to LogoSuite we unfortunately won't get it for 'free' here unless we opt in. I think we're doing this because we want to avoid a conflict in names between named children, but that's potentially an edge case. I'd assume in most cases we'd want to benefit from auto opt-in where possible. We could instead manually opt-out those conflicting props as they are really only solving the need to flatten Storybook arguments and nothing to do with the component itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that's exactly right. I thought this behaviour would be more predictable and intuitive.

You want to add a new control to the story? Just add the type to the top of the file too.

As opposed to

You want to add a new prop to one of the LogoSuite components? It might cause conflicts in the Storybook types, regardless of whether this prop is actually used in Storybook.

It's just a matter of preference, but I prefer the explicit, opt-in approach to the more magic, opt-out approach. Adding a type to cover new functionality feels much more natural to me than having types be automatically added for me and then potentially having to manage conflicts. If we adopt this approach everywhere then conflicts might not be that uncommon as we reuse prop names fairly regularly across components.

Copy link
Collaborator

@rezrah rezrah left a comment

Choose a reason for hiding this comment

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

Thanks @joshfarrant, appreciate you going through all that feedback. LogoSuite is looking really cool 👍

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.

3 participants