Skip to content

feat(ui-components): add info variant and hover state to Button component - #45541

Merged
ahmaxed merged 3 commits into
freeCodeCamp:mainfrom
huyenltnguyen:feat/button-info-variant
Mar 31, 2022
Merged

ahmaxed merged 3 commits into
freeCodeCamp:mainfrom
huyenltnguyen:feat/button-info-variant

Conversation

@huyenltnguyen

Copy link
Copy Markdown
Member

Checklist:

  • I have read freeCodeCamp's contribution guidelines.
  • My pull request has a descriptive title (not a vague title like Update index.md)
  • My pull request targets the main branch of freeCodeCamp.
  • I have tested these changes either locally on my machine, or GitPod.

Ref #45357

This PR adds info variant and hover styles to Button component. I'll leave the focus and active state in a next PR, since I'll need to do some research on them.

Note: Reviewing by commits is recommended.

Screenshot

Info variant

Light Dark
Screen Shot 2022-03-26 at 23 22 11 Screen Shot 2022-03-26 at 23 22 19

Hover state

Variant Light Dark
Primary Screen Shot 2022-03-26 at 23 23 59 Screen Shot 2022-03-26 at 23 23 52
Danger Screen Shot 2022-03-26 at 23 24 34 Screen Shot 2022-03-26 at 23 24 41
Info Screen Shot 2022-03-26 at 23 24 55 Screen Shot 2022-03-26 at 23 24 48

@huyenltnguyen
huyenltnguyen requested a review from a team March 26, 2022 16:26
@gitpod-io

gitpod-io Bot commented Mar 26, 2022

Copy link
Copy Markdown

@github-actions github-actions Bot added the scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. label Mar 26, 2022
@ghost

ghost commented Mar 26, 2022 •

Copy link
Copy Markdown

👀 Review this PR in a CodeSee Review Map

Preview the Review Map

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

--default-background-tertiary: var(--gray80);
--default-background-quaternary: var(--gray75);
--default-background-danger: var(--red15);
--default-background-info: var(--blue30);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@ahmadabdolsaheb I already forgot why we went with the "default" prefix, but looking at these now, I wonder if we should remove it to keep the variables name a bit shorter. The "default" part implies that there are overrides, but I don't believe we want that.

Same thoughts on the color names in the tailwind config file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yep, we could drop them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Might be an anti pattern, but we could just give the foreground color on hover. That way we could cut down on variables.
For instance:
text-default-foreground-primary could become hover:text-default-background-primary

@ahmaxed ahmaxed Mar 31, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let me know if you have done the research on best practices; otherwise the scenario above seems plausible and we could batch it in a pr with the default removals.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry, I have stepped away from the work a bit.

Your suggestion makes sense now that I'm looking at the variable list again. I think for states (focus, hover, active), we can just use an existing variable instead of having a dedicated set for them, since the states for a button might be different from, say, an <input />.

I'll have a PR to clean these up and add a note on this in the contributing doc 🙂

@ahmaxed
ahmaxed merged commit 791b8b5 into freeCodeCamp:main Mar 31, 2022
@huyenltnguyen
huyenltnguyen deleted the feat/button-info-variant branch April 10, 2022 08:24
@huyenltnguyen huyenltnguyen mentioned this pull request Apr 10, 2022
4 of 10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants