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

Export createSvgIcon from @material-ui/icons #20268

Closed
1 task done
darkowic opened this issue Mar 25, 2020 · 6 comments
Closed
1 task done

Export createSvgIcon from @material-ui/icons #20268

darkowic opened this issue Mar 25, 2020 · 6 comments
Labels
new feature New feature or request waiting for 👍 Waiting for upvotes

Comments

@darkowic
Copy link
Contributor

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

Summary 💡

Export createSvgIcon function from @material-ui/icons to be able to create custom icons while reusing the createSvgIcon function.

Examples 🌈

import { createSvgIcon } from '@material-ui/icons'

Motivation 🔦

It would be great to reuse the createSvgIcon function in other projects. It is possible to import the function by

import createSvgIcon from '@material-ui/icons/utils/createSvgIcon';

but it is an internal function so the API may change anytime soon without any warning.

@darkowic darkowic changed the title Export createSvgIcon from icons Export createSvgIcon from @material-ui/icons Mar 25, 2020
@eps1lon
Copy link
Member

eps1lon commented Mar 25, 2020

This is an internal utility that serves our specific purpose. We need to be able to adjust this to our internal needs which makes it unsuitable for public release.

It's tiny enough that you can build your own utility or just use <SvgIcon>{path}</SvgIcon>

@eps1lon eps1lon closed this as completed Mar 25, 2020
@eps1lon eps1lon added the new feature New feature or request label Mar 25, 2020
@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 25, 2020

I have seen @dmtrKovalenko face the same problem: https://github.com/mui-org/material-ui-pickers/blob/next/lib/src/_shared/icons/ArrowDropDownIcon.tsx#L2.

So far, we have

  • core: 1 duplicated version
  • lab: 1 duplicated version
  • icons: 1 duplicated version
  • pickers: import a private version from core

@eps1lon
Copy link
Member

eps1lon commented Mar 25, 2020

I have seen @dmtrKovalenko face the same problem

This is not the same problem though. You're talking about internal usage which is quite different from public release.

@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 25, 2020

You're talking about internal usage which is quite different from public release.

@eps1lon Well, I believe we have no precedent of importing private modules between @material-ui/x packages, but I don't see anything wrong with it, as we can control these imports (not the case when in third-parties code) :).

What do you think of refactoring "lab" and "icons" to follow the approach of "pickers"? I would reduce the bundle size (deduplication for private usage).

@darkowic
Copy link
Contributor Author

This is not the same problem though. You're talking about internal usage which is quite different from public release.

It's kind of util that could be reused between different internal packages but also outside - like in my project where I need to create several custom icons.
Creating new util is not a big deal ofc but still, it is some duplication that could be avoided.

@oliviertassinari
Copy link
Member

@darkowic For the public aspect, I think that we could delay the effort to a point where we have more user requests. Also, I think that we should look into how it fits with the SVGR ecosystem before moving forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request waiting for 👍 Waiting for upvotes
Projects
None yet
Development

No branches or pull requests

3 participants