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

Convert buttons to CSS variables #34600

Merged
merged 3 commits into from
Feb 15, 2022
Merged

Convert buttons to CSS variables #34600

merged 3 commits into from
Feb 15, 2022

Conversation

mdo
Copy link
Member

@mdo mdo commented Jul 28, 2021

Todos:

  • Replace focus styles with rgb color CSS vars (needs Updated utility API (css-vars utils and new bg/color utils), plus new root CSS variables #34100 merged first)
  • Replace or update gradient() mixins. Nothing to figure out, we're good to go!
  • Figure out border-radius property vs @include border-radius(). Dropped the mixin here and am using a fallback value in the CSS variable given the valid-radius() function.
  • Figure out RFS sizing in CSS vars (maybe relevant: Any way to use css variables? rfs#311). I've removed the font-size() mixin from the button-size() mixin and default .btn value. It doesn't seem to matter comparing this PR to main.
  • Replace or update outline variant mixin and styles.
  • Fix .btn-link
  • Tighten bundlewatch before the final merge

Biggest concern for all these PRs will be compiled file size of our CSS. Looking at the bootstrap.css diff though:

319 insertions(+), 485 deletions(-)

This will change a bit once :focus styles are restored.


Preview: https://deploy-preview-34600--twbs-bootstrap.netlify.app/docs/5.1/components/buttons/

@mdo mdo added this to In progress in v5.3.0 via automation Sep 6, 2021
@mdo mdo force-pushed the css-vars-btn branch 3 times, most recently from 34d2052 to 03a8e7f Compare September 8, 2021 03:47
@mdo mdo removed this from In progress in v5.3.0 Sep 8, 2021
@mdo mdo added this to In progress in v5.2.0 via automation Sep 8, 2021
@mdo mdo marked this pull request as ready for review September 8, 2021 03:58
@mdo mdo requested a review from a team as a code owner September 8, 2021 03:58
@mdo
Copy link
Member Author

mdo commented Sep 14, 2021

Per #34435, we may want to migrate this back to v4 with a separate PR to fix in Sass.

@Kopyov

This comment has been minimized.

scss/_buttons.scss Show resolved Hide resolved
scss/_buttons.scss Show resolved Hide resolved
@Sir-Genius
Copy link
Contributor

Sir-Genius commented Dec 25, 2021

Outline button has no disabled border color variable.

scss/_buttons.scss Outdated Show resolved Hide resolved
@mdo mdo force-pushed the css-vars-btn branch 2 times, most recently from a51a830 to 81ae9bb Compare February 9, 2022 22:16
@mdo
Copy link
Member Author

mdo commented Feb 9, 2022

This PR should be in even better shape than before. I've just pushed a few more changes to migrate all of Bootstrap's docs buttons to CSS variables, renamed and cleaned up a few things, and added an example of our custom buttons via CSS variables to the buttons docs page.

Let me know how you're feeling about this all @ffoodd, would love your eyes on it :).

Copy link
Member

@ffoodd ffoodd left a comment

Choose a reason for hiding this comment

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

A few questions around the PR— it looks fine already 👌

Very nice work, I really like the naming move to accent in the docs ❤️

scss/_buttons.scss Outdated Show resolved Hide resolved
scss/_buttons.scss Outdated Show resolved Hide resolved
scss/_buttons.scss Show resolved Hide resolved
scss/mixins/_buttons.scss Show resolved Hide resolved
site/content/docs/5.1/components/buttons.md Outdated Show resolved Hide resolved
v5.2.0 automation moved this from In progress to Reviewer approved Feb 14, 2022
- Use CSS variables wherever possible
- Rename purple-bright to violet for brevity, add CSS vars versions
- Rename download to accent
@mdo mdo merged commit 3e6265a into main Feb 15, 2022
v5.2.0 automation moved this from Reviewer approved to Done Feb 15, 2022
@mdo mdo deleted the css-vars-btn branch February 15, 2022 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
v5.2.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants