Shmew / Feliz.MaterialUI

Feliz-style Fable bindings for Material-UI
https://shmew.github.io/Feliz.MaterialUI/
MIT License
70 stars 19 forks source link

useTheme hook #32

Closed Shmew closed 4 years ago

Shmew commented 4 years ago

I noticed the useTheme hook wasn't in your library. I was able to import it and use it fine on this example, not sure if you just hadn't gotten around to testing it yet or if there was another reason. I don't mind playing around with it more if you need me to validate some other part of it.

cmeeren commented 4 years ago

It already exists as Styles.useTheme

Shmew commented 4 years ago

Oh, whoops. Do you think it might be worth moving all hooks to a single module? It's not super obvious (especially for those of us like myself that can be pretty dense at times 😅) to know where to look when we want to use a hook.

Although, once you have your docs page fully fleshed out I supposed that would resolve this too. (BTW your docs page looks very slick!)

cmeeren commented 4 years ago

The MUI docs seem to place more emphasis on "these are all the styling options" (which include both hooks and HOCs) rather than "here are all the hooks" and "here are all the HOCs". As a consequence, I have adopted the same mindset, though that is as much by accident as it is by conscious choice on my part.

I'm always open to suggestions. Please let me know if you have any concrete suggestions of how to structure, well, basically everything in Feliz.MaterialUI that isn't a component or a prop :)

Shmew commented 4 years ago

Yeah I think it's fine as is, looking at their docs the import statements are from styles so it's actually much closer to their api anyways.

I think what threw me off the most was the existence of a Hooks module so I thought I would find all hooks there. What do you think about Mui.useMediaQuery as that's also closer to their api and eliminates that kind of misunderstanding?

import useMediaQuery from '@material-ui/core/useMediaQuery';
cmeeren commented 4 years ago

There was actually a separate issue just for that :) #3

I kinda like having Mui contain only components, but I'm a sample size of one, and am very open to other opinions.