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

ButtonGroup component #185

Merged
merged 17 commits into from Feb 3, 2021
Merged

ButtonGroup component #185

merged 17 commits into from Feb 3, 2021

Conversation

manuelpuyol
Copy link
Contributor

This PR creates a ButtonGroupComponent based on https://primer.style/css/components/buttons#button-groups and https://primer.style/components/Buttons#default-examples
I decided to make the buttons slots to make it harder to use this component incorrectly, so users don't add things that shouldn't be inside the BtnGroup

image

@vercel
Copy link

vercel bot commented Feb 3, 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/view-components/5f6dqnj6b
✅ Preview: https://view-components-git-btn-group-component.primer.vercel.app

@manuelpuyol
Copy link
Contributor Author

Had to recreate because force-push messed some stuff up

class ButtonGroupComponent < Primer::Component
include ViewComponent::SlotableV2

renders_many :buttons, ->(classes: "", **kwargs) do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

From the other PR:

@joelhawksley: What do you think is the best way to document that these slots take all of the arguments for ButtonComponent?

@manuelpuyol: That's a good question. I don't think we aren't documenting slots in other components
@srt32 wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

@manuelpuyol sounds like it might be time to invent the right solution then 😄

We can leave this PR as-is in that regard for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've seen us document slots v1 behavior like this https://github.com/primer/view_components/pull/182/files#diff-a870f147518fb3db01d7aacb41bc479052f20a68f7e0f934fc78715d1851dd68R36-R39. We'd have to rewrite the Rakefile parser to handle slots v2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since I'm not defining a class as a slot here idk how YARD would deal with it

Copy link
Contributor

@srt32 srt32 Feb 3, 2021

Choose a reason for hiding this comment

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

Open an issue for us to track figuring this out? No need to block here.

@vercel vercel bot temporarily deployed to Preview February 3, 2021 16:31 Inactive
@vercel vercel bot temporarily deployed to Preview February 3, 2021 17:15 Inactive
@vercel vercel bot temporarily deployed to Preview February 3, 2021 18:02 Inactive
@srt32 srt32 mentioned this pull request Feb 3, 2021
@@ -12,6 +12,7 @@
**/*.stories.json
**/node_modules/
*.log
*.orig
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this extension?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's a file that sometimes is generated by my difftool

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally you'd handle this in a global .gitignore on your machine, but I'm cool merging this in ❤️

@vercel vercel bot temporarily deployed to Preview February 3, 2021 20:38 Inactive
@joelhawksley
Copy link
Contributor

Mind adding a CHANGELOG entry?

@vercel vercel bot temporarily deployed to Preview February 3, 2021 22:49 Inactive
@manuelpuyol
Copy link
Contributor Author

Mind adding a CHANGELOG entry?

I just noticed that we added a bunch of things without updating the CHANGELOG, I'll merge this as-is and open a PR with the updates!

@manuelpuyol manuelpuyol merged commit d464d1d into main Feb 3, 2021
@manuelpuyol manuelpuyol deleted the btn-group-component branch February 3, 2021 22:52
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.

None yet

3 participants