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

Added Polymorphic MinimalFooter link #272

Merged
merged 4 commits into from
May 15, 2023

Conversation

JoshBowdenConcepts
Copy link
Contributor

Summary

We're looking to replace the custom Footer we have on some pages of https://resources.github.com/ with MinimalFooter. To do this, we need the option to allow button as alternative to MinimalFooter.Link.

Example: as you can see at the bottom of https://resources.github.com/enterprise/trial/, we have a button in the footer for "Manage cookies", which opens an overlay to manage cookie settings. The styling should be the same as the text link.

List of notable changes:

  • updated MinimalFooter.Link element to allow for polymorphism

What should reviewers focus on?

  • Making sure that the Storybook feature Button Links works as expected.

Steps to test:

  1. Open the MinimalFooter component in CI-deployed preview environment
  2. Go to ButtonLinks feature story in Storybook
  3. Verify that the Button Links story behaves as expected

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

@JoshBowdenConcepts JoshBowdenConcepts linked an issue May 10, 2023 that may be closed by this pull request
@changeset-bot
Copy link

changeset-bot bot commented May 10, 2023

🦋 Changeset detected

Latest commit: 764477d

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 Patch
@primer/brand-primitives Patch
@primer/brand-e2e Patch
@primer/brand-fonts Patch
@primer/brand-config Patch
@primer/brand-storybook Patch

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

@github-actions
Copy link
Contributor

github-actions bot commented May 10, 2023

🟢 No design token changes found

@github-actions
Copy link
Contributor

github-actions bot commented May 10, 2023

🟢 No visual differences found

Our visual comparison tests did not find any differences in the UI.

@JoshBowdenConcepts JoshBowdenConcepts temporarily deployed to github-pages May 11, 2023 16:57 — with GitHub Actions Inactive
</MinimalFooter.Link>
</MinimalFooter>
)
MaximumLinks.storyName = 'Button Links'
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 changing the wrong story, and is presenting like this in Storybook..

Screenshot 2023-05-13 at 16 59 45

Recommend it's removed altogether as it's not any different to the default name.

Suggested change
MaximumLinks.storyName = 'Button Links'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been completed in this SHA


function Link({href, children}: PropsWithChildren<LinkProps>) {
const Link = <C extends React.ElementType = 'a'>({as, children, ...rest}: PropsWithChildren<LinkProps<C>>) => {
const Component = as || 'a'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this be restricted to one of 'a' or 'button'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been completed in this SHA

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you!

type LinkProps = {
href: string
} & BaseProps<HTMLAnchorElement>
type LinkProps<C extends React.ElementType> = BaseProps<C> & {as?: C} & Omit<React.ComponentPropsWithoutRef<C>, keyof C>
Copy link
Collaborator

@rezrah rezrah May 13, 2023

Choose a reason for hiding this comment

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

Could you update the prop table in docs too please? 🙏

Screenshot 2023-05-13 at 16 58 44

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been completed in this SHA

@JoshBowdenConcepts JoshBowdenConcepts temporarily deployed to github-pages May 15, 2023 13:39 — with GitHub Actions Inactive
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.

🚀 Ship it

@JoshBowdenConcepts JoshBowdenConcepts merged commit f5c9656 into main May 15, 2023
@JoshBowdenConcepts JoshBowdenConcepts deleted the polymorphic-minimal-footer-link branch May 15, 2023 14:53
@primer-css primer-css mentioned this pull request May 15, 2023
@stefankp
Copy link

Nice 👏

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.

MinimalFooter: allow buttons
3 participants