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
Conversation
Co-authored-by: Joel Hawksley <joelhawksley@github.com>
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/primer/view-components/5f6dqnj6b |
Had to recreate because force-push messed some stuff up |
class ButtonGroupComponent < Primer::Component | ||
include ViewComponent::SlotableV2 | ||
|
||
renders_many :buttons, ->(classes: "", **kwargs) do |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
@@ -12,6 +12,7 @@ | |||
**/*.stories.json | |||
**/node_modules/ | |||
*.log | |||
*.orig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this extension?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ❤️
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! |
This PR creates a
ButtonGroupComponent
based on https://primer.style/css/components/buttons#button-groups and https://primer.style/components/Buttons#default-examplesI 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