Skip to content
Discussion options

You must be logged in to vote

The equivalent Vanilla Extract styles would be:

import { globalStyle, style } from "@vanilla-extract/css";

export const first = style({
  width: "100vw",
});

export const second = style({
  selectors: {
    [`${first} &`]: {
      height: "auto",
      position: "relative",
    },
  },
});

export const third = style({
  selectors: {
    [`${first} ${second} &`]: {
      width: "50px",
    },
  },
});

globalStyle(`${first} ${second} ${third} img`, {
  opacity: 0.5,
});

A few things to note:

  • Vanilla Extract doesn't support more than 1 level of nested selectors, so you have to define each classname separately and construct the nesting yourself
  • You can only target the current classname w…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@WreewanMorhee
Comment options

Answer selected by WreewanMorhee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants