stitches icon indicating copy to clipboard operation
stitches copied to clipboard

Docs: Recipe on how to create styles with dynamic values using scoped tokens

Open hadihallak opened this issue 3 years ago • 7 comments

Showcase how to create styles that map to dynamic values using scoped tokens for cases mentioned here #721

If you have any examples you'd like us to cover please share them in the comments.

hadihallak avatar Jun 06 '22 17:06 hadihallak

Hi @hadihallak,

I have a few questions.

We are implementing a huge E-Commerce platform UI on Stitches and what we need most is to send dynamic values to variants via props.

[I'm asking for clarity. "https://github.com/stitchesjs/stitches/pull/721#issue-966540684" seems to have merged the suggested codes made here. Will this proposition be released?](https://github.com/stitchesjs/stitches/pull/721#issue-966540684 Is there a way to do the proposition mentioned here right now?. Is the topic you opened here to share the ways to do this?)

In my review "https://github.com/stitchesjs/stitches/pull/721#issue-966540684" the PR of the proposition made here has been accepted and merged into the canary branch. In which version will this development be published?

bbg avatar Jun 20 '22 18:06 bbg

Hi @hadihallak, I have been waiting for your answer to our questions for a long time. Your answers on this matter are important to us. Thanks.

bbg avatar Jul 10 '22 12:07 bbg

@bbg sorry this got burred in my notifications. In general and by design Stitches tries to re-use styles whenever is possible to optimize performance. However, we can achieve something similar to dynamic variants by using css properties. will try to create an example/package for this in the following days and share it with you here

hadihallak avatar Jul 10 '22 19:07 hadihallak

Thank you @hadihallak, I'm patiently waiting for your example/package.

bbg avatar Jul 13 '22 12:07 bbg

Hello @hadihallak, Any progress on this?

bbg avatar Jul 25 '22 15:07 bbg

@bbg Working on this right now. will share ASAP

hadihallak avatar Jul 27 '22 23:07 hadihallak

@bbg Take a look at the code here https://github.com/hadihallak/stitches-dynamic-variants live demo https://codesandbox.io/s/damp-hill-m4gwwc?file=/src/App.tsx

hadihallak avatar Jul 28 '22 04:07 hadihallak