Repository navigation
Closed
Labels
scope: tools/scriptsScripts for supporting dev work, generating config and build artifacts, etc.status: PR in worksWork in Progress (WIP) Issues.
Description
Current specs
- Border width: 3px
- Font:
Roboto Mono, monospace - Variants:
- Primary
- Info
- Danger (on the Setting page)
- Link (on the donation modal)
- Sizes:
- Large
- Medium (default)
- Small
- States:
- Disabled
- Hover state
- Button types:
type="button"type="submit"
- Themes:
- Light
- Dark
- Can be a link (supports
hrefprop) - Can be used as a block (stretch)
- Supports text + icon
- Accepts ARIA attributes
What's missing
- Loading state
- Focus outline
- Active state
Screenshots
| Usage | Light theme | Dark theme |
|---|---|---|
| Primary | ![]() |
![]() |
| Primary hovered | ![]() |
![]() |
| Primary disabled | ![]() |
![]() |
| Danger | ![]() |
![]() |
| Danger hovered | ![]() |
![]() |
| Link | ![]() |
![]() |
| Link hovered | ![]() |
![]() |
| Info | ![]() |
![]() |
| Info hovered | ![]() |
![]() |
Implementation plan
Use the bootstrap v3.3.7 stylesheet for styling references.
Props interface
| Prop | Type | Required | Default | Note |
|---|---|---|---|---|
variant |
'primary' | 'danger' | 'link' |
'primary' |
||
size |
'large' | 'medium' | 'small' |
'medium' |
||
type |
'submit' | 'button' |
'button' |
||
disabled |
boolean |
Use aria-disabled under the hood (ref) |
||
loading |
boolean |
|||
loadingText |
string |
Required if loading is true |
||
block |
boolean |
|||
onClick |
React.MouseEventHandler |
|||
href |
string |
Render an a instead of a button element if this prop is defined |
Spacing and typography
The current values of font size, line height, and padding from Bootstrap seem a bit strange to me, as there are some odd numbers in there, which I think would add some challenges in scaling/positioning. Now that we switch to Tailwind, my proposal is to adopt its system and slightly adjust the styling of our component.
| Size | Current | New |
|---|---|---|
| Small | padding: 5px 10px font-size: 16pxline-height: 1.5 |
padding: 4px 10px font-size: 16pxline-height: 1.5 |
| Medium | padding: 6px 12px font-size: 18pxline-height: 1.42857143 |
padding: 6px 12px font-size: 18pxline-height: 1.42857143 |
| Large | padding: 10px 16px font-size: 23pxline-height: 1.3333333 |
padding: 10px 16px font-size: 24pxline-height: 1.3333333 |
References:
What's not included
Rough delivery plan
(TBU)
- Remove the stub Button component with a new, basic one (variants and sizes) - feat(ui-components): implement basic Button component #45421
- Support
ref- chore(ui-components): minor adjustments in Button component #45480 - Add support for
infovariant - feat(ui-components): add info variant and hover state to Button component #45541 - Add support for hover state - feat(ui-components): add info variant and hover state to Button component #45541
- Support various button states and theming - feat(ui-components): add states and full-width support to Button component #45665
- Ensure active and focus states are covered
- Support inline and block usages - feat(ui-components): add states and full-width support to Button component #45665
- Support link usage - feat(ui-components): add support for link to Button component #45671
- Ensure that we render a
buttoninstead of anaifdisabledistrue
- Ensure that we render a
- Build ButtonGroup (probably a low priority since there isn't a use case for it yet)
Reacted by Ahmad Abdolsaheb and Sem Bauke
Metadata
Metadata
Assignees
Labels
scope: tools/scriptsScripts for supporting dev work, generating config and build artifacts, etc.status: PR in worksWork in Progress (WIP) Issues.




















Activity
ahmaxed commentedon Mar 7, 2022
Thanks for taking on the button component and for listing our buttons and their states.
In the past we styled the buttons' active, hover, and focus states to override Boostrap's styles.
It might be a good idea to include the active and focus states in the styles as well and replace them with more representative styles on the next iteration.
Note: we also have a less obvious button that we use the in modal
'btn-link'default:

Hover

huyenltnguyen commentedon Mar 7, 2022
Thanks @ahmadabdolsaheb!
I have updated the original post. My plan is to have a dedicated PR just for the button states, since there are a lot to cover.
I have added
linkto the variant list that we need to support. This just reminded me that the accessibility aspect will be very interesting, since there are some differences in the behaviors of button and link. For example, if the component is used as a link and is disabled, we will need to render abuttontag instead of ana, since semantically links cannot be disabled 😄ahmaxed commentedon Mar 7, 2022
The reason that is called link button is that it looks like an active element, but does not steal attention from the donation buttons.
After the bootstrap migration is complete, and the custom component migration is complete, we could audit our library.
Perhaps we could rename it as tertiary or secondary and style it accordingly.
ahmaxed commentedon Mar 15, 2022
Just a heads up that we have a
btn-infoin the codebase. The color needs a little work but we can change that later. You could view it in the settings page of the /settings page or in production next week :)ahmaxed commentedon Mar 15, 2022
Also other than the styles, what are the challenges of having the CTA be in the same component with the rest of the buttons?
ahmaxed commentedon Mar 18, 2022
There are some custom styles that utilizes bootstrap styles such as
.btn.We should either include them in the component for now, or re-adjust the custom styles when we move the buttons to production.
huyenltnguyen commentedon Mar 20, 2022
Yeah it's mostly the styles. we don't seem to have a CTA button in dark theme, and the button is currently a link (
<a>). I think it would be easier to maintain and develop if we have the component as a separate one, rather than as a variant.Agreed. The custom styles have eaten a lot of my time, as I have to decide whether I should copy-paste the styles or try to map the them to what Tailwind has 😅 I've been opting for the latter, it takes a bit more time but will help reduce code that we have to clean up later.
huyenltnguyen commentedon Apr 25, 2022
As noted in #45671 (comment), we will have a Link component that supports the link variant mentioned in the original post.