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

Ability to customize icons; avoid large icon dependency #5

Closed
baleeds opened this issue Jan 17, 2020 · 6 comments
Closed

Ability to customize icons; avoid large icon dependency #5

baleeds opened this issue Jan 17, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@baleeds
Copy link

baleeds commented Jan 17, 2020

Chonky looks really cool!

According to bundlephobia, Chonky is a large package (~500kb), but ~70% comes from the font-awesome dependency.

I confirmed this by adding the library to my project and comparing my bundle size.

See this issue on create-react-app where they discuss almost the exact thing, where tree shaking doesn't occur for dependencies of dependencies in CRA.

An alternative would be to add some way to customize icons, while also switching the defaults to use deep imports, as seen here.

Have you given this any thought before?

@TimboKZ
Copy link
Owner

TimboKZ commented Jan 22, 2020

PR #6 is now merged, closing this issue.

@TimboKZ TimboKZ closed this as completed Jan 22, 2020
@TimboKZ TimboKZ added the enhancement New feature or request label Aug 5, 2020
@TimboKZ
Copy link
Owner

TimboKZ commented Aug 5, 2020

Reopening this issue for visibility, as this feature is not yet included in v1.x.

@TimboKZ TimboKZ reopened this Aug 5, 2020
@ttamminen
Copy link

Hi @baleeds & @TimboKZ !

Do you have plans to implement this optimization to the 1.x branch or have things changed drastically and applying the PR to the 1.x branch has become difficult?

The bundle size is indeed huge. I could do some bundle splitting in the app so that the Chonky would be loaded only in the specific pages, but that's not the most optimal solution.

@TimboKZ
Copy link
Owner

TimboKZ commented Sep 10, 2020

Hello there, I have plans to address this and also add some new features around icon support.

Applying the existing PR again is not an option, as Chonky was rewritten from scratch between 0.x and 1.x. There are also some conceptual differences between the code in the PR and what I want to implement.

ETA of this feature is about 1 month, likely sooner.

@TimboKZ
Copy link
Owner

TimboKZ commented Nov 5, 2020

This feature is now supported in the most recent Chonky 2.x alpha release. As shown in 2.x usage docs, Chonky no longer provides a built-in icon component. Instead, user must explicitly provide a pre-built or a custom icon component:

import { setChonkyDefaults } from 'chonky';
import { ChonkyIconFA } from 'chonky-icon-fontawesome';

setChonkyDefaults({ iconComponent: ChonkyIconFA });

I'll add some examples of custom icon components to the 2.x Storybook at a later date.

@ttamminen
Copy link

Great, thank you! I'll give it a try next week.

@TimboKZ TimboKZ closed this as completed Nov 22, 2020
samuelncui pushed a commit to samuelncui/Chonky that referenced this issue Oct 4, 2023
…_yarn/immer-9.0.6

Bump immer from 8.0.4 to 9.0.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants