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

Allow custom children in ActionItem #1196

Merged
merged 8 commits into from
May 3, 2021
Merged

Allow custom children in ActionItem #1196

merged 8 commits into from
May 3, 2021

Conversation

dgreif
Copy link
Member

@dgreif dgreif commented Apr 29, 2021

Some use cases for ActionList have revealed that the built-in rendering is not always providing enough flexibility, such as if you want to render the text inside a <Label>. Although we can override rendering with renderItem, this fully replaces the entire item and removes helpful tools like onAction and the selected checkmark. Additionally, the requirement of text on ItemProps forces consumers to convert existing data structures into a secondary data structure in order to provide text. This change makes all fields optional (which opens it up for use by any item interface), and adds a children prop that will render a custom ReactNode before the text section of the item.

Screenshots

image

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@vercel
Copy link

vercel bot commented Apr 29, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-components/CvhfL166KaFEGLfBxapmui6xYh6y
✅ Preview: https://primer-components-git-action-item-children-primer.vercel.app

@changeset-bot
Copy link

changeset-bot bot commented Apr 29, 2021

🦋 Changeset detected

Latest commit: 0468584

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

This PR includes changesets to release 1 package
Name Type
@primer/components 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

@vercel vercel bot temporarily deployed to Preview April 29, 2021 23:26 Inactive
@dgreif dgreif requested a review from VanAnderson April 30, 2021 16:09
@vercel vercel bot temporarily deployed to Preview April 30, 2021 16:12 Inactive
@vercel vercel bot temporarily deployed to Preview April 30, 2021 19:13 Inactive
Copy link
Contributor

@VanAnderson VanAnderson left a comment

Choose a reason for hiding this comment

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

Looks pretty straight forward - non blocking but maybe we could update the docs to at least list the new option to use children?

@dgreif
Copy link
Member Author

dgreif commented Apr 30, 2021

@VanAnderson I couldn't find any docs that explicitly define ItemProps. Happy to update them if I just overlooked them. For now, I think it's just examples within the ActionList docs. This is an area that we will need to revisit when we have solidified the API I think.

@vercel vercel bot temporarily deployed to Preview April 30, 2021 20:34 Inactive
src/ActionList/Item.tsx Outdated Show resolved Hide resolved
src/ActionList/Item.tsx Outdated Show resolved Hide resolved
Co-authored-by: Clay Miller <clay@smockle.com>
@vercel vercel bot temporarily deployed to Preview April 30, 2021 21:25 Inactive
@vercel vercel bot temporarily deployed to Preview April 30, 2021 22:31 Inactive
Copy link
Member

@smockle smockle left a comment

Choose a reason for hiding this comment

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

LGTM! 😎 Nice work on this!

@vercel vercel bot temporarily deployed to Preview May 1, 2021 16:25 Inactive
Co-authored-by: Trevor Gau <trevorsg@gmail.com>
@vercel vercel bot temporarily deployed to Preview May 3, 2021 20:14 Inactive
@vercel vercel bot temporarily deployed to Preview May 3, 2021 20:17 Inactive
@dgreif dgreif merged commit d29741c into main May 3, 2021
@dgreif dgreif deleted the action-item-children branch May 3, 2021 20:38
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.

4 participants