-
I am trying to build something like this in StyleX stylex-pseudo.mp4CodePen here: https://codepen.io/zaydek/pen/qEWapJM?editors=1000 I'm trying to do something like this: groupIsNested: {
"::before": {
borderColor: "color-mix(in hsl, transparent, white 25%)",
borderLeftStyle: "solid",
borderLeftWidth: 1,
content: "",
insetBlock: 0,
insetInlineStart: `calc(${SIDEBAR_ITEM_BLOCK_SIZE}px / 2)`,
position: "absolute",
},
":hover::before": {
borderColor: "purple",
borderLeftStyle: "solid",
borderLeftWidth: 1,
content: "",
insetBlock: 0,
insetInlineStart: `calc(${SIDEBAR_ITEM_BLOCK_SIZE}px / 2)`,
position: "absolute",
},
}, (Don't mind the repeating code just trying to figure this out) It seems like I've also tried this: "::before": {
default: null,
border: {
default: "1px solid color-mix(in hsl, transparent, white 25%)",
":hover": "1px solid red",
},
} And border: {
default: null,
"::before": {
default: "1px solid color-mix(in hsl, transparent, white 25%)",
":hover": "1px solid red",
},
} But those don't seem to work. I know I can implement this using JS but am curious: Is it possible to support |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You're trying to do this. groupIsNested: {
"::before": {
borderColor: "color-mix(in hsl, transparent, white 25%)",
borderLeftStyle: "solid",
borderLeftWidth: 1,
content: "",
insetBlock: 0,
insetInlineStart: `calc(${SIDEBAR_ITEM_BLOCK_SIZE}px / 2)`,
position: "absolute",
},
":hover": {
'::before': {
borderColor: "purple",
}
},
}, This pattern is very discouraged because you're essentially doing a descendent selector. We recommend using variables for this: groupIsNested: {
[vars.borderColor]: {
default: "color-mix(in hsl, transparent, white 25%)",
":hover": "purple",
},
"::before": {
borderColor: vars.borderColor,
borderLeftStyle: "solid",
borderLeftWidth: 1,
content: "",
insetBlock: 0,
insetInlineStart: `calc(${SIDEBAR_ITEM_BLOCK_SIZE}px / 2)`,
position: "absolute",
},
}, |
Beta Was this translation helpful? Give feedback.
You're trying to do this.
This pattern is very discouraged because you're essentially doing a descendent selector.
We recommend using variables for this: