swordev / suid

A port of Material-UI (MUI) built with SolidJS.
https://suid.io
MIT License
676 stars 48 forks source link

Targeting another `styled` component within `styled` #155

Closed evertheylen closed 1 year ago

evertheylen commented 1 year ago

I was wondering if behaviour like this is in any way supported:

const SomeComponent = styled('div')({
  color: 'green',
});

const ParentComponent = styled('div')({
  [SomeComponent]: {
    color: 'pink',
  },
});

(stackblitz, but it might be of limited use)

Emotion, the underlying library for MUI's styled function, does support it although you need a babel plugin.

evertheylen commented 1 year ago

I just now got around to using this feature (and replacing the hacky solution I had for this), it works great. Thanks!