ItsJonQ / g2

✨ An experimental reimagining of WordPress components
http://g2-components.com/
MIT License
105 stars 12 forks source link

Try interpolating styled components #273

Closed sarayourfriend closed 3 years ago

sarayourfriend commented 3 years ago

Just a start, we'll see what we can make of this.

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/itsjonq/g2/CUkWBRxh9CzrMzpV7m3FQ5MuAdpL
✅ Preview: https://g2-git-try-interpolate-styled-components-itsjonq.vercel.app

ItsJonQ commented 3 years ago

@sarayourfriend Yay!!! This was exactly the setup I was imagining :). But instead of :

// css.js
            if (isPolymorphicComponent(arg)) {
                return `[data-interpolation-name="${arg.__interpolationName__}"]`;
            }

When I was imagining this, I thought the CSS selector would be a custom CSS className of some kind. Having a data attribute is basically the same thing 🤠

Taking this for a spin now! ❤️