You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly, the project looks awesome, having come from a heavily styled-components and styled-system background.
My first question, is around how you might expose props for creating UI components. Often with projects, we tend to abstract the UI components such as Button, Input and so on, into more reusable components with strict Typescript interfaces.
Into it's own Button component and expose props such as variant which may then further style the component.
This removes the requirement to always pass a bunch of reused props every time the primary button is needed. It also removes the @xstyled... calls from all pages and into less components, should the need to change arise.
Previously with styled-system we used to generate/build prop types (interfaces) so that we could further expose those props should we wish. For the above example, we might want to expose bg but everything else be behind the scenes. What would be the recommended approach for this?
Furthermore, is there any documentation around creating variants? I read that some of the variants part was deprecated as it was confusing. But interested to learn more around what approach might be best. In the above example, just creating variants for buttons that are predefined by the actual Button component, rather than exposing x.button everywhere.
Thanks!
The text was updated successfully, but these errors were encountered:
💬 Questions and Help
Firstly, the project looks awesome, having come from a heavily
styled-components
andstyled-system
background.My first question, is around how you might expose props for creating UI components. Often with projects, we tend to abstract the UI components such as Button, Input and so on, into more reusable components with strict Typescript interfaces.
In essence, we would take something like this....
Into it's own Button component and expose props such as
variant
which may then further style the component.This removes the requirement to always pass a bunch of reused props every time the primary button is needed. It also removes the
@xstyled...
calls from all pages and into less components, should the need to change arise.Previously with
styled-system
we used to generate/build prop types (interfaces) so that we could further expose those props should we wish. For the above example, we might want to exposebg
but everything else be behind the scenes. What would be the recommended approach for this?Furthermore, is there any documentation around creating variants? I read that some of the variants part was deprecated as it was confusing. But interested to learn more around what approach might be best. In the above example, just creating variants for buttons that are predefined by the actual
Button
component, rather than exposingx.button
everywhere.Thanks!
The text was updated successfully, but these errors were encountered: