GithubHelp home page GithubHelp logo

Comments (7)

klzns avatar klzns commented on June 2, 2024 2

I totally agree with you that's not the ideal 💯

But our BuyButton component was implemented in a way that it uses the Styleguide's Button component as the root component and our Styleguide was not implemented with CSS Handles or Store Framework in mind since it's development started before Store Framework.

We could add a <div> wrapping the Styleguide's Button making the BuyButton component to be something like:

<div class="vtex-store-components-2-x-buyButton">
  <button class="vtex-button" />
  ...

But this change would break stores that are customizing the CSS with hierarchical HTML structure in mind. Example:

.flex-layout--buyButton > button {
  border-radius: 10px;
}

A store with this CSS would break its layout when we added this new div element because now the button is not a direct child of .flex-layout--buyButton (and that's why the styles v2 limitations was put in place).

The solution I proposed it's a workaround to the current limitations.

We intend to solve this in a new major version of this block 🙏

from store-components.

klzns avatar klzns commented on June 2, 2024 1

You can achieve that by changing this value:
https://github.com/vtex-apps/store-theme/blob/master/styles/configs/style.json#L243

This will affect all instances of border radius Tachyons classes:

image

from store-components.

cristian-milea avatar cristian-milea commented on June 2, 2024

@klzns , thanks for your response

This is not ideal. It also changes all br2 tachyon usages for vtex-input-prefix__group (the search container)

if i follow this method also for padding, like pa0 for the button (i have them larger in the design), i will break the menu container, where pa0 is ok

from store-components.

klzns avatar klzns commented on June 2, 2024

Can you print the HTML element you are trying to target?

from store-components.

cristian-milea avatar cristian-milea commented on June 2, 2024

i want to make all buttons have certain radius, paddings, and font sizes without affecting other elements

<button tabindex="0" class="vtex-button bw1 ba fw5 v-mid relative pa0 lh-solid br2 min-h-regular t-action bg-action-primary b--action-primary c-on-action-primary hover-bg-action-primary hover-b--action-primary hover-c-on-action-primary pointer w-100 " type="button"><div class="vtex-button__label flex items-center justify-center h-100 ph6 w-100 border-box " style="padding-top:.25em;padding-bottom:.32em"><div class="vtex-add-to-cart-button-0-x-buttonDataContainer flex justify-center"><span class="vtex-add-to-cart-button-0-x-buttonText">Adaugă în coș</span></div></div></button>

from store-components.

klzns avatar klzns commented on June 2, 2024

In fact, this handle doesn't target the button element. To achieve this you can wrap the buy button with a flex-layout with a blockClass:

  "flex-layout.row#buy-button": {
    "props": {
      "blockClass": "buyButton",
      "marginTop": 4,
      "marginBottom": 7
    },
    "children": ["buy-button"]
  },

Then in styles/css/vtex.flex-layout.css target the button with the allowed :global(.vtex- selector:

.flexRow--buyButton :global(.vtex-button) {
  border-radius: 10px;
}

You can see that it worked:
image
image

About font on buttons, it might make sense to change the typography tokens related to buttons:
https://github.com/vtex-apps/store-theme/blob/master/styles/configs/style.json#L318-L337

More on this here: https://styleguide.vtex.com/#/Styles?id=section-typography#action

from store-components.

cristian-milea avatar cristian-milea commented on June 2, 2024

That means we have to wrap ALL our buy buttons everywhere in the site and it is cumbersome.
Why isn't Vtex exposing the buy-button with a css handle as all the other components?

from store-components.

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.