-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
I want to get ride of the naive-ui library and make a custom internal mini ui library.
This issue is to track the progress of this task and give the reason why I want to do it.
Why ?
- naive-ui components are not customizable enough
- to make component that perfectly fit the needs of the project (like input level validation)
- increase the accessibility of the app and ease the tests (add labels, test ids)
- lighter components -> smaller bundle size
- have more control on the style of the components
- and the most important to me : make the app ssg, currently it's not possible because of some of the naive-ui library
How ?
The idea is to make a custom ui library in the src/ui folder, and use it in the app (the devx is really pleasing thanks to auto import and auto complete).
A preview of the components can be found at localhost:3000/c-lib/c-button (only in dev mode, it's not deployed on the website or in the bundles).
So we need to replace all the naive-ui components by the custom ones.
Naive-ui is used in the whole app, it's a big task and I don't want a big bang change, so we'll iterate until the dependency can be removed.
And as naive-ui components are prefixed by an n (like n-button), I will prefix the custom components by a c (like c-button).
Follow up
- Button
- create the component src/ui/c-button
- replace all the naive-ui button
- Card
- create the component src/ui/c-card
- replace all the naive-ui card
- Input text
- create the component src/ui/c-input-text
- replace all the naive-ui input text
- Input group
- create the component
- replace all the naive-ui input group
- Space
- Replace all the n-space by a div and unocss directives (ex:
<n-space justify="center">-><div flex justify-center>)
- Replace all the n-space by a div and unocss directives (ex:
- Text
- Replace all the n-text by a div and unocss directives
- Input number
- create the component
- replace all the naive-ui input number
- Switch
- create the component
- replace all the naive-ui switch
- Select
- create the component
- replace all the naive-ui select
- Typography
- Tooltips
- Icons
- n-p and n-text
- n-h
- ...
I plan to update this issue with the progress of the task.