-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Theme] Fix a few unthemable elements #2892
Conversation
511ffaf
to
b05418b
Compare
b05418b
to
3082089
Compare
@oliviertassinari sounds like a fair plan. FYI, I found a bunch more hard-coded values, I think I've got nearly all of them, except for one or two like error colors and media overlays. Should be pretty close to having themes apply cleanly now, though there may still be some places where the default body text color was being assumed. I did also change the |
3082089
to
b657650
Compare
Rebased against master |
@@ -86,6 +83,10 @@ const Avatar = React.createClass({ | |||
this.setState({muiTheme: newMuiTheme}); | |||
}, | |||
|
|||
getTheme() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the usage of getTheme
method from this PR? It's always called multiple times inside the same function. That seems inefficien.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with this logic because it is used already in multiple components...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with this logic because it is used already in multiple components...
That's true, we should be consistent regarding this point, but that's not the case right now in our code base.
@alitaheri @newoga What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think we should stop using the function. I haven't see the getTheme
function pattern around in the library much but if it's around, we should move towards not doing it.
Personally, even if we need a function to help with codeflow/logic I'd rather put the function at the top of the module rather as a member of the React component. The more functions we have of components, the more likely someone will read source and abuse them.
Actually, this is one of the reasons why I prefer using functional components when possible over classes because it just takes the choice away.
In addition, this particular issue is why I was hoping we could figure out something like #2509. A lot of times when we do have the theme, we do have to traverse down a lot of nested properties to get what we need. I'm still not sure best approach but I'm not entirely convinced our current one is the best one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the removal of getTheme
it seems really redundant.
we do have to traverse down a lot of nested properties to get what we need
It's not us it's javascript 😆 😆 although nested destructuring takes some of the pain away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not us it's javascript 😆 😆 although nested destructuring takes some of the pain away
Haha! I agree about regarding the nested destructuring
@pdf @oliviertassinari Let's get rid of the getTheme function, looking again this is fairly simple component, and I think it's fine just breaking it up earlier into a const
in the render method. Ironically this component could become a functional component once style-propable
is gone.
@pdf Thanks for your work on this! |
2a4b822
to
50a74a9
Compare
I believe this commit addresses feedback. It looks like the list of components below currently use the
|
@@ -101,7 +103,7 @@ const List = React.createClass({ | |||
}, | |||
|
|||
subheader: { | |||
color: Typography.textLightBlack, | |||
color: theme.subheaderTextColor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will conflict with https://github.com/callemall/material-ui/pull/2979/files#diff-509c50933d8b7384457d8c9e34a34374L104.
I feel like it would be better to merge the other PR that introduce a Subheader
component, then this one.
Yes, we should do it at some point but I think that it's out of the scope of this PR. |
50a74a9
to
04acee8
Compare
Actioned feedback, rebased against master. Will update again if you want to merge #2979 first. |
@pdf The |
Any info on when this will be merged? I could really do with the card title and headers being themeable. I have tried making the changes manually but to no avail. |
I should be able to take another pass at this on the weekend. |
That would be fantastic, Like I said tried making the changes I can see here by adding the theme colours but that didn't seem to take affect at all. the card background colour changes just not the titles of the subtitles :/ |
Well, 334a1a8 and some others make this rebase pretty laborious. I think it might be easier to rewrite at this stage, will take me a little bit. |
04acee8
to
69335df
Compare
Replace hard-coded color values with colors derived from either text or canvas color. Closes mui#3135
69335df
to
c402885
Compare
Had to bump eslint-plugin-react to get the docs to build, think this should be pretty close. There might still be instances of body text color being assumed to be black for the light theme (which can result in illegible text for dark themes), but I think fixing that for |
@pdf This is great! Thanks a lot 👍 👍 I'm all green @oliviertassinari take a look and merge 😁 |
Eagerly awaiting this merge :D thanks for the hardwork @pdf and @alitaheri |
Seems like there is a conflict here. @pdf Could you take a look? |
There's a conflict now because a whole truckload of PRs were just merged in front of this again, including stuff like a cleanup of |
Sorry about it! And the migration processes isn't finished yet. We can wait until it's done 😁. |
Judging by the changes, it'll probably be another re-write for this PR if there're more components to be updated in similar fashion. I guess just ping me at some stage when you think there's a good time to get this merged. This is for a personal project though, so I can only work on it in my spare time. |
Thanks, I will keep you up to date!
Same as me 👍 |
@pdf Would it be alright if I gave you a list of components that are already migrated, then you could start with those? I really appreciate your patience and work on this. |
Actually on second look the only component you modified that hasn't been migrated yet is |
@newoga rebase conflicts will tell me which components have been updated 😉, but I won't be able to get back to this for a few days at a minimum (possibly a couple of weeks as I have some other engagements coming up), so don't rush anything on my account. |
Okay no worries then! Thanks much @pdf! |
@pdf This requires a lot of work! I'm intercepting this PR. Don't work on it anymore, I'll fix the conflicts tonight so we can merge this soon 👍 Thanks a lot for your initial work on this 👍 |
Used palette.textColor to replace hard-coded blacks, should work for
both dark and light themes
Closes #3135.