Support for Pseudo-Elements
I've been able to make good use of the pseudo class support within stylemanager, however I'm finding myself needing to use pseudo elements (specifically ::before) and it doesn't seem like there is support for these yet.
If they are actually implemented and I'm just missing it I'd love to know, but if not I don't mind seeing if I can implement it myself.
Good catch, yeah it looks like constants like ::before and ::after need to be added to the constants list. If there are any issues with the double colon, it would probably require a change here, but any changes are probably minor. Most of the support should be there. If you want to take a shot at adding in support that would be great, thanks so much!
Accidentally closed the issue sorry about that. I did get it working just by passing them into the pseudo class, and there were no issues. The complexity came in when trying to chain them together with pseudo-classes, as the most recent css spec (IIRC) has some restrictions around order and different combinations.
If you're fine with them just being added as constants and ignoring the more advanced use cases I'll go ahead and add them to the constants file.
So you're just appending the elements to the class? Yeah, I guess that would work. We could also do something like adding this to the CompositeStyle:
type CompositeStyle struct {
Default Props
PseudoClasses map[string]Props
PseudoElements map[string]Props // Add this line
MediaQueries map[string]Props
}
Usage might look like this:
compositeClassName := styleMgr.AddCompositeStyle(CompositeStyle{
Default: Props{
Color: "black",
},
PseudoClasses: map[string]Props{
PseudoHover: {Color: "blue"},
},
PseudoElements: map[string]Props{
PseudoBefore: {
Content: `" "`,
Display: "block",
Height: "100%",
Width: "100%",
BackgroundColor: "yellow",
},
},
})
Hi @chasefleming and @rxdps93, please check out PR #148 for pseudo elements support.
Awesome @whisk , thank you for taking this! Will check it out.
Closing this issue as its been resolved with #148