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

[Drawer] Provide prop PaperComponent #23384

Closed
1 task done
maxkahnt opened this issue Nov 3, 2020 · 4 comments
Closed
1 task done

[Drawer] Provide prop PaperComponent #23384

maxkahnt opened this issue Nov 3, 2020 · 4 comments
Labels
component: drawer This is the name of the generic UI component, not the React module!

Comments

@maxkahnt
Copy link

maxkahnt commented Nov 3, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

Drawer should provide a prop to override PaperComponent (not only PaperProps) like, e.g. Dialog does.

Motivation 🔦

I occasionally need to wrap/replace the paper component.

@maxkahnt maxkahnt added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 3, 2020
@oliviertassinari oliviertassinari added component: drawer This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 3, 2020
@oliviertassinari
Copy link
Member

Thanks for raising, interesting issue. We cover something similar in #23043, in theory, it's going to be solved with #21453, we have started to account for in the development of v5.

@maxkahnt
Copy link
Author

maxkahnt commented Nov 4, 2020

Yeah, that looks like a big chunk of work ;). What would be a good way to work around it for now?
I can see the following three options:

  1. Use Dialog instead and style it according to my needs. I can override PaperComponent and PaperProps there.
  2. Manually one-time override all styling of paper and nest a component that suits my needs.
  3. Create a local copy of the Drawer implementation and hardcode-replace paper with my component.

I favor 2 as it seems to be the simplest given my current knowledge level in react, material-ui and jsx etc. in general. It generates minor css/nesting overhead. 1 would keep me within the framework entirely, but drop semantics. It probably also involves a decent amount of style overrides. 3 would probably be cleanest, but having had a quick look at the source I am not confident that hard replacing the component is all that straighforward, or is it? Is there an (maybe easier) option I overlooked?

@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 4, 2020

@maxkahnt You can customize the CSS of the Paper to reset the style and render your own as a child (2.), the simpler and safer.

@oliviertassinari
Copy link
Member

Closing for #21453

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: drawer This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

2 participants