-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[AppBar] Remove style-propable mixin #3183
Conversation
@newoga I have a proposal for these things: What if we do this like: // imports ...
const styles = {
mainElement: { // this will always be the same instance forever!
boxFlex: 1,
flex: '1',
},
root: (someProp, otherProp) => ({ // this can be memoized later on with ease
// calculate according to only two props, only recalculate if any of the props change
}),
title: (theme) => ({ // this can be initiated once per theme.
// calculate according to theme, only recalculate if theme changes.
}),
// ...
};
// the component This is only for discussion. if you guys think this is worth a discussion I'll open an issue for it. |
marginRight: 8, | ||
marginLeft: -16, | ||
}, | ||
iconStyle: { |
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.
What about flattening style
and iconStyle
?
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 would prefer that too 👍 I'll give it a go, thanks!
Sure, open an issue up 😁! I also was wondering if an approach like that was possible but I hadn't fully conceptualized and tried anything yet. 👍 |
Signed-off-by: Neil Gabbadon <neil.gabbadon@emikra.com>
Done, flattened |
That looks good. @alitaheri Feel free to merge 👍 |
[AppBar] Remove style-propable mixin
Thanks a lot, this is looking good 👍 😍 |
@newoga Actually I rather investigate further. it's not so straight forward. Since we should also support SSR, we'll have some issues we have to handle properly. so I might even build my own package for this. It's gonna need a bit work and thought. I'll get back to you guys when I think of something 😄 |
@alitaheri That's an interesting proposal and doesn't seem to be linked to the style approach we follow. For instance I think that it would work with css classname. Well, in this case it would be overkill 😁. |
@oliviertassinari No i won't go for what I purposed up there. I'm thinking more of a HOC that passes down styles if they change. this means the calculated styles will only be passed down if they change and if they don't change the render will stop. if they change only the changed styles will be new instances not every one of them. I still haven't figured out how to achieve this. But i think this is necessary. I'll probably create a repository for it with lots of tests for it before getting back to you. |
@alitaheri I love this idea. That would make our component unstyled by default 😍. |
Thanks ^_^ I'm gonna think of something soon, stay tuned 😆 😆 |
@alitaheri Good luck with that! I had a very similar idea when I thought of moving the |
@newoga I actually use |
Signed-off-by: Neil Gabbadon neil.gabbadon@emikra.com