Git Product home page Git Product logo

ui's Introduction

UI

A React UI component library compatible with Next13.

Many of my own projects are developed with this UI library. Components in this library are heavily scoped to those specific projects and hence are not suitable for general use.

Credits to shadcn/ui for the initial inspiration.

Dependencies

  • Tailwind (required)
  • Zustand (required)
  • RadixUI (required)
  • NextJS 13
  • Supabase
  • Tanstack query
  • Tanstack table
  • Framer motion
  • i18next & react-i18next (not using next-i18next or NextJS's built-in i18n features)
  • React-hook-form (required for forms)

See package.json for exhaustive list of required/optional peer dependencies

Usage

  1. Setup Git submodules e.g. git submodule add https://github.com/<user>/<repo> <dest-dir>

For NextJS

Add configurations as follows:

/** @type {import('next').NextConfig} */
module.exports = {
  experimental: {
    serverActions: true,
  },
  webpack: (config) => {
    config.resolve.symlinks = false;
    return config;
  },
  typescript: {
    ignoreBuildErrors: true,
  },
};

Add path aliases to tsconfig.json as follows:

{
  "paths": {
    "@@/*": ["<path-to-ui>/src/*"]
  }
}

For Tailwind (required)

Copy example configuration from samsze1/ui-demo

In package.json

{
  "scripts": {
    "build": "pnpm submodule && next build",
    "submodule": "git submodule update --init --recursive --remote"
  }
}

For other package bundlers

Setup path resolvers similar to the tsconfig above.

Change UI lib version

  1. cd into submodule
  2. git checkout <ref>
  3. Stage/commit the submodule reference

Not working?

See example project in samsze1/ui-demo

Why distribution by source?

Advantages

  • Unified build pipeline
  • Minus the headaches of dependency management (peer dependencies, optional dependencies)

Disadvantages

  • More complex to deploy (e.g. for edge)

Development Setup

This step is optional. Developing within the submodule rather can make things simpler for multi projects setup.

  1. Clone the UI lib to local
  2. Replace the submodule with a symbolic link to that repo. โš ๏ธ Don't stage/commit the symbolic link

If you accidentally stage/commit the symlink

  1. Remove .git/modules/<xxx>
  2. Remove entry from .git/config

Still doesn't work?

  • Try git rm --cache -r <xxx>
  • As the last resort, do git reset --hard

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.