Repository navigation
Description
Context
This issue is to track the migration of Button component in the donation form, as part of #52092. I need to cut a separate issue for this as I encountered some incompatibilities in the ui-components library and wanted to document them.
There are two display types of the donation form:
| Type | Visual |
|---|---|
| As page content | ![]() |
| As a modal | ![]() |
There are four buttons that we need to make changes to:
Issues and Solutions
"Edit amount" and "Ask me later" buttons having unsupported styles
The "Edit amount" and "Ask me later" buttons are styled with the .btn-link class from Bootstrap, which strips off the border and adds an underline to the text, making the buttons look like a link. However, the Button from ui-components does not support this variant.
Approaches:
- Use
ui-componentsButton, but override its CSS - Convert the buttons to the native
<button>element, style them using a combination of our CSS and Bootstrap's CSS
Decision: I'll go with (2) as it's a cleaner approach. We can decide if ui-components Button should support this display variant after the migration.
"Donate" button having unsupported styles
Similar to the above case, the "Donate" button is an odd one as its styles don't match the one in ui-components (round border, custom color token, different font weight, etc.). The component has a lot of CSS overrides that I think it's better to let it use a native <button> instead.
I think I'm seeing a pattern here. There is a CTA button on the landing page that also needs custom CSS, so perhaps we could build a CallToActionButton component in ui-components or add this as a variant to the existing Button.
Decision: Temporarily use the native <button> element for this one. We will revisit the library after the migration.
"Try again" button does not blend well with the alert box
The primary variant of Bootstrap is blue while ours is gray, and putting it on the alert isn't really aesthetic on dark mode (also notice the button border is almost invisible).
| Theme | State | Visual |
|---|---|---|
| Dark | at rest | ![]() |
| Dark | hovered | ![]() |
| Light | at rest | ![]() |
| Light | hovered | ![]() |
(I'm pretending to be a designer here.)
I don't think this is the Button's fault, but rather, it's because Alert doesn't have dark mode, and it being too bright in dark mode increases the contrast, making the Button stand out more. Maybe dimming Alert background in dark mode would help.
Approaches:
-
Keep using the
primaryvariant and sort our theAlertstyling instead -
Replace the
primaryvariant withinfo
It looks a little better withinfo, but the usage is a bit wrong semantically:
-
Consider this button a special case, use the native
<button>element and style it following Bootstrap
Decision: I think (1) is the proper fix, but I want to avoid making things worse (and not to mention scope creep). So I'll go with (3) for now as a stop-gap solution. We can revisit the component library and address its usage limitation after the migration.














Activity
ahmaxed commentedon Nov 14, 2023
Thanks for laying out all of the different variations.
Using native elements and styling them should work for both of the instances. We can decide on the next iteration what to do with them.