Add the possibility to pass app component as 'as' prop to H built-in components ex AddToCartButton needs as input the project button.client #323
bitforcesrl
started this conversation in
Ideas + Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@morganmccunn thanks for the updates you give us yesterday.
i'm looking at the repo, checking some components.
it's clear to not hard code strings and use only headless ui components in the hydrogen built-in components but we need the ability to "ask" to those component to use specific app styled components. More details:
in the demo there is the button component customised with variants classes etc,
https://github.com/Shopify/hydrogen/blob/main/packages/dev/src/components/Button.client.jsx
but then here:
https://github.com/Shopify/hydrogen/blob/main/packages/hydrogen/src/components/AddToCartButton/AddToCartButton.client.tsx
there is the add to cart button completely un-styled.
In the demo you've extracted the classes of the primary button style and applied to the addToCart inner button.
this is weird, a lot repetitive, bug prone, not well maintainable, and inside the button.client we could have added tons of other features (ex tracking) that are not present in the addtoCartButton. we need a method to pass the
as
prop the button.client to the addToCartButton.the addtoCartButton should extend the props it has to handle ex onClick so it can create the cart + add the line to the cart, then call the button.client onClick
this should be valid for the whole framework otherwise we'll end up with some hidden differences in terms of ui/functionalities
Beta Was this translation helpful? Give feedback.
All reactions