Comments (7)
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.
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:
from store-components.
@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.
Can you print the HTML element you are trying to target?
from store-components.
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.
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;
}
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.
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)
- [sku-selector] Decide whether SKU fields with a single value are displayed or not
- Allow Character Reference in product-name block
- Missing ProductServices component at react folder
- [BUG] Thumbnail Video's Vimeo
- [BUG] onInputChange not working correctly
- Class undefined of ImagePlaceholder in productpage
- [InfoCard] Button element nested inside an anchor
- [Shared]
- [SearchBar] Autocomplete not opening on focus with inputType search
- sku-selector is rerendering the parent silde
- Color variation field name should be captured from store theme
- Infocard
- Carousel bug in product-images HOT 1
- Brand Name HTML Tag HOT 1
- SearchBar problems with inputType=search
- [Urgent] Availability Subcriber returns 403 HOT 3
- CSS class in the thumbs swiper
- Zip Code go to checkout
- Dropdown select options don't change on click on Firefox HOT 1
- [Availability Subscriber] - User Language
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from store-components.