Skip to content
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

[Help] Support for Material Ui 5 with Javascript #28

Closed
Bramgus12 opened this issue Oct 21, 2021 · 2 comments
Closed

[Help] Support for Material Ui 5 with Javascript #28

Bramgus12 opened this issue Oct 21, 2021 · 2 comments

Comments

@Bramgus12
Copy link

I am currently using a project with Material UI 4 and am in the process of changing to MUI 5. I had used a lot of makeStyles and would like to still use this way of styling. I saw this repo and thought this would be a great way to still use makeStyles, but then saw that you guys specifically made this for TS and not JS. So I am asking if you guys support JS and if you do, how can I then add it to my project? Maybe there could be a specific guide with everything you need to do to convert your MUI 5 project to use this library?

@garronej
Copy link
Owner

garronej commented Oct 21, 2021

Hi @Bramgus12,
You can use TSS with a plain JavaScript problem. Infact there is no such thing as an npm module that would work only with TypeScript.
No specific instruction are required to make it work, just follow the guide in the README and remove the types annotation whenever there is.

Essentially:

- const useStyles = makeStyles<{ color: "red" | "blue" }>()(
+ const useStyles = makeStyles()( 
    (theme, { color }) => ({
        "root": {
            color,
            "&:hover": {
                "backgroundColor": theme.primaryColor,
            },
        },
    }),
);

@Bramgus12
Copy link
Author

Thanks for the reply, I'll try to get it to work tonight. Maybe you can add somewhere in the readme that it will work on Javascript or even add examples for javascript? This will most certainly help the junior developers!

garronej added a commit that referenced this issue Oct 21, 2021
gitbook-com bot pushed a commit that referenced this issue Jan 23, 2022
gitbook-com bot pushed a commit that referenced this issue Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants