GithubHelp home page GithubHelp logo

Comments (2)

mahoneycm avatar mahoneycm commented on September 26, 2024

Hello there @justingiovanetti ! As long as I understand correctly, I am unable to reproduce this bug.

After changing the background color of usa-button, I was able to add a variant class and see the variant's color take hold.

I wanted to note that there is no primary variant as suggested in your instructions. The base usa-button will use the primary color token. If you were to add say, usa-button--secondary to use your project's secondary color token, you should see the update as expected.

While we're on the topic of theme tokens, you can update the value of tokens like primary and secondary in your project theme settings by updating the token value. After updating these values the button variants will reflect your chosen colors without having to write any custom scss! You can find a list of the color tokens available to you and their default values on our Settings page.

If I've misunderstood or if you have any further questions, just let me know! Thanks.

from uswds.

justingiovanetti avatar justingiovanetti commented on September 26, 2024

@mahoneycm thank you for the response. My apologies for the reference to "primary." As you are correct, it's not a class.

The above aside, my initial report still stands. To help clarify the problem, I've included an example demo below. The demo demonstrates (1) the problem, (2) various workarounds, and (3) a proper solution.
https://justfront-end.github.io/USWDS-Button-Issue/USWDS-Button-Issue.html

In addition to the demo, the following is a further elaboration.

“After changing the background color of usa-button, I was able to add a variant class and see the variant's color take hold.”

That’s not the problem.

By variant, I’m referring to the provided variations of the button. Whether it’s at the preprocessed “tokens” level or talking about the additionally applied classes, it’s a variation. The wiring of the base button to use secondary, warm accent, or cool accent as a token is just wiring details, it’s not the concern.

It’s also not an issue of writing custom scss.

The problem is with the specificity of the CSS.

We shouldn’t need to set up a build system, run Node, set up an npm/yarn managed project, run Sass, and the numerous additional steps to change a button color.

To be clear, it’s not about how quickly one can get all that setup, it’s about the quality of the produced css. The current implementation produces a brittle structure.

https://justfront-end.github.io/USWDS-Button-Issue/USWDS-Button-Issue.html

from uswds.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.