Skip to content

[ui-lib] Switching to a custom ui lib and get rid of naive-ui #400

@CorentinTh

Description

@CorentinTh

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
  • Card
    • create the component src/ui/c-card
    • replace all the naive-ui card
  • 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>)
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions