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

Add new OptionButton component #1065

Merged
merged 3 commits into from
Jun 2, 2023
Merged

Add new OptionButton component #1065

merged 3 commits into from
Jun 2, 2023

Conversation

lyzadanger
Copy link
Contributor

This PR adds a new OptionButton component. It is a semi-generalized implementation of the new button we need to satisfy hypothesis/lms#2955

I ended up creating a new button that is intended for use "when you might otherwise use a radio button or select element but you need a button instead." In full purity, the set of buttons in the LMS content-selection interface that we're targeting should maybe instead be radio buttons or a select element. But it's impractical to make that big of a change right now, so this component serves as an option-like button.

It takes an optional details prop (for content to render at the right edge of the button), aliases selected to pressed and otherwise forwards all other non-styling props to Button. Eh, the pattern-library docs explain this more clearly.

I've also updated the pattern-library prototype page for LMS content selection to use this component.

image

@lyzadanger lyzadanger requested a review from acelaya June 1, 2023 16:33
@codecov
Copy link

codecov bot commented Jun 1, 2023

Codecov Report

Merging #1065 (13a9c76) into main (0a10b93) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main     #1065   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           53        54    +1     
  Lines          741       750    +9     
  Branches       270       276    +6     
=========================================
+ Hits           741       750    +9     
Impacted Files Coverage Δ
src/components/input/OptionButton.tsx 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@acelaya acelaya left a comment

Choose a reason for hiding this comment

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

👏🏼

@lyzadanger lyzadanger merged commit 9a1c463 into main Jun 2, 2023
@lyzadanger lyzadanger deleted the option-button branch June 2, 2023 12:11
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.

2 participants