Skip to content

Migrate Button component in donation form #52349

Closed

Description

@huyenltnguyen

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 Screenshot 2023-11-14 at 17 23 31
As a modal Screenshot 2023-11-14 at 17 25 17

There are four buttons that we need to make changes to:

Button State Visual
Donate at rest Screenshot 2023-11-14 at 15 51 01
Donate hovered Screenshot 2023-11-14 at 17 38 50
Edit amount at rest Screenshot 2023-11-14 at 17 40 35
Edit amount hovered Screenshot 2023-11-14 at 17 41 53
Close / Ask me later (only displayed on the donation modal) at rest Screenshot 2023-11-14 at 15 51 01
Close / Ask me later (only displayed on the donation modal) hovered Screenshot 2023-11-14 at 16 07 24
Try again at rest Screenshot 2023-11-14 at 17 47 01
Try again hovered Screenshot 2023-11-14 at 17 47 46

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:

  1. Use ui-components Button, but override its CSS
  2. 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 Screenshot 2023-11-14 at 18 06 50
Dark hovered Screenshot 2023-11-14 at 18 06 57
Light at rest Screenshot 2023-11-14 at 18 11 03
Light hovered Screenshot 2023-11-14 at 18 11 09

(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:

  1. Keep using the primary variant and sort our the Alert styling instead

  2. Replace the primary variant with info
    It looks a little better with info, but the usage is a bit wrong semantically:

    Screenshot 2023-11-14 at 18 14 09
  3. 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

  1. added
    scope: UI
    platform: learn
    status: PR in works
    on Nov 14, 2023
  2. ahmaxed commented on Nov 14, 2023

    @ahmaxed
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

platform: learnscope: UIstatus: PR in works

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions