I'm trying to move my SCSS code into React components using microsoft's mergeStyles utility, which is a part of its FluentUI framework. I'm stuck figuring out how to specify "::before" as a selectors property. For some reason, mergeStyles() recognized ":hover::before" but not "::before" on its own. Please see comments in code below for example. Any help appreciated. Thank you.
export const getClassNames = (): ISidebarClassNames => {
return mergeStyleSets({
sideNavItem: {
position: "relative",
selectors: {
":not(:last-child)": {
marginBottom: ".5rem",
},
// This works and "hover::before" does indeed triggers "scaleY(1)".
// Why then does "::before" not work on its own (see below)?
":hover::before": {
transform: "scaleY(1)",
},
// TODO: This does not work in mergeStyles() but does work if coded in SCSS.
"::before": {
content: "",
position: "absolute",
top: 0,
left: 0,
bottom: 0,
width: "3px",
backgroundColor: "red",
transform: "scaleY(0)",
}
}
}