-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Selecting children by class name #12
Comments
Hi @jsakas, |
I think I can come up with an API like that: const useStyles = makeStyles<{ color: "red" | "blue" }>()(
(theme, { color }, classes) => ({
"el1": {
[`&:hover .${classes.el2}`]: {
"display": "block"
},
},
"el2": {
"display": "none"
},
})
); Any though? |
Yes, I think that would be a great alternative to the jss syntax. |
This seems pretty critical to anyone who is migrating from Material UI v4 to v5 but can't move to styled components syntax yet. I'm trying to address myself on a fork but it seems like the proposed API might not be possible due to the order of operations in the library. |
Agreed, this needs to be done ASAP. I will try to free up time in the coming days.
To implement the proposed API I think we will need a preflight to get |
I will have a look tonight. Maybe I can get it done in a couple of hours... |
I have started on the work but have been unable to get it to work properly with typescript typings. The |
const useStyles = makeStyles()((theme, _params, css) => {
const child = {
"background": "blue",
"border": "1px solid black"
};
return {
"parent": {
"border": "1px solid black",
"padding": 30,
[`&:hover .${css(child)}`]: {
"background": "red",
}
},
child
};
});
//...
<div className={classes.parent}>
<div className={classes.child}>
Background should turn red when mouse is hover the parent.
</div>
</div> |
Hi @jsakas, |
Hello, I am trying to figure out how to select nested children by class name using this library. Below is an example of how we did it with JSS:
Is this currently supported? The docs say:
But don't clarify how we would do the above.
The text was updated successfully, but these errors were encountered: