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

A stab at creating a themeable decorator #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ntgn81
Copy link
Owner

@ntgn81 ntgn81 commented Dec 18, 2015

My stab at consolidating all theme stuff used in components into one place.

  • HOC to wrap components to add muiTheme context, or default theme if context not given
  • Components themselves, once wrapped, will receive muiTheme through props.muiTheme.

I tried to wrap DatePicker and it's immediate children - TextField, DatePicker

Issues:

  • TextField uses StylePropable mixin
    • Updated StylePropable to consider this.props.muiTheme (not really an issue)
  • DatePickerDialog exposes public methods (show, dismiss). HOC, in it's simplest form, hides them.
    • This makes clicking on DatePicker input not opening the Dialog, as the show method is being called through ref
    • I had to declare statics.publicMethods in DatePicker, and make the HOC proxy those methods through
    • This, I think, is a cool, unintended feature - declaring which methods are public - good for documentation.
  • The problem I don't have good solution for is when the components are being accessed directly for it's properties ( do we have that case?). I see Dialog is accessing it's children directly for height and style, but they are React components, not MUI components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant