Comments (10)
Any though?
Yes, I think that would be a great alternative to the jss syntax.
from tss-react.
I have started on the work but have been unable to get it to work properly with typescript typings. The classes
object keeps coming back as Record<never, string>
and I am unsure why. See the PR here: #13
from tss-react.
Hi @jsakas,
Sorry, it's an oversight of my part.
I wasn't encline to implement this API because it's hard to make it type safe.
Now I understand that it's a must have.
I will implement a feature to cover this use case, I can't tell you exactly when though.
from tss-react.
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?
from tss-react.
I will implement a feature to cover this use case, I can't tell you exactly when though.
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.
from tss-react.
This seems pretty critical to anyone who is migrating from Material UI v4 to v5 but can't move to styled components syntax yet.
Agreed, this needs to be done ASAP. I will try to free up time in the coming days.
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.
To implement the proposed API I think we will need a preflight to get [ "el1", "el2" ]
or maybe we could make it work with proxies...
from tss-react.
I will have a look tonight. Maybe I can get it done in a couple of hours...
from tss-react.
Nice!
from tss-react.
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>
from tss-react.
Hi @jsakas,
I am sorry I had to update the API for nested selector. The approach based on css
was broken.
https://github.com/garronej/tss-react#selecting-children-by-class-name
from tss-react.
Related Issues (20)
- How to opt out of RTL transformation? HOT 3
- <GlobalStyles /> don't work properly with next.js app folder HOT 7
- cannot Import multiple makeStyles HOT 1
- Use eslint rule to detect unused classed with imports HOT 2
- React 16.10.0 failed to install @ mui/material HOT 1
- How to use with css and styled apis. HOT 1
- yarn install with pnp mode complains about missing dependency @mui/material HOT 3
- NextJS/MUI/TSS - Cannot read properties of undefined (reading 'classes') HOT 3
- Hard reload after any file change HOT 2
- TssCacheProvider is not working when used with emotion cache and mui 5 HOT 6
- Using with Shadowed Web Components HOT 3
- Next.js: Applying augmentDocumentWithEmotionCache to document breaks AMP pages HOT 2
- The right way typing props when using withStyles HOT 3
- Invalid type for withStyles HOT 4
- Mantine integration
- Using `@import` rule within `<GlobalStyles />` component HOT 8
- `GlobalStyles` create multiple <style data-emotion="css-global">...<style> HOT 1
- Cannot read properties of undefined (reading 'length') in useGuaranteedMemo HOT 3
- MUI V5: Performance issues HOT 4
- Prop `className` did not match. HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tss-react.