nyxb-ui / ui

Fusion UI library combining Shadcn/UI and MagicUI. Featuring 150+ free and open-source components built with React, Typescript, Tailwind CSS, and Framer Motion. Create stunning, responsive interfaces effortlessly. 100% open-source.
https://nyxbui.design
MIT License
534 stars 16 forks source link

[feat]: Use `cn` instead of `ny` for class name helper #20

Open bryaneaton13 opened 1 month ago

bryaneaton13 commented 1 month ago

Feature description

I'm suggesting switching back to the standard cn class name helper that shadcn and magicui use for the tailwind merge utility helper. The ny function is a custom thing that's not as clear what it means.

This will help when getting AI to auto-generate code (like GitHub copilot or Cursor) using the components already in the code base. And it'll help when using tools like v0.dev to create the UI elements.

Affected component/components

All Components with styling

Additional Context

Right now, the manual installation shows using this class name helper in lib/utils.ts:

import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"

export function ny(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs))
}

I'm suggesting using this instead:

import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs))
}

Before submitting

Related commits

https://github.com/nyxb-ui/ui/commit/91f664a https://github.com/nyxb-ui/ui/commit/283b44d73d7ed8e7427dacaba3fa47e0c5186e59 https://github.com/nyxb-ui/ui/commit/a702f31b31bc26c744ee4045ee2840c78abf1137 https://github.com/nyxb-ui/ui/commit/134658ba424c17046be09a5e147b1402db994a28 https://github.com/nyxb-ui/ui/commit/dd2ea8dc35a3702d77026751795cb9828a891dab https://github.com/nyxb-ui/ui/commit/dac8517048b13b1b45dc23fc5d637040c71bc46d https://github.com/nyxb-ui/ui/commit/5be2fdb906ad2c57608be7dc3e9ce63390a557f1

github-actions[bot] commented 1 month ago

Hello there 👋 Thanks for opening your first issue. We welcome you to the ui community! 😊

lacymorrow commented 1 month ago

Yep, as few things "custom" as possible.

EdMaxi commented 3 weeks ago

+1 for it. IA's will work better with standards, if possible, when possible to sticky with standards of things already done previously.

lacymorrow commented 3 weeks ago

Plus, lots of folks use shadcn/ui. If you keep things standard we can use the same CLI to install components (like v0, magicui, personal registries, etc)

RayRizzling commented 1 week ago

Am I the only one who likes the ny ? ^^ it's helpful as I can clearly see the origin of the component when combining multiple frameworks/code snippets, like aceternity + nyxb. I run a snippet on the codebase to change the imports from import { ny } to import { cn as ny } when adding the whole lib or manually when just adding some snippets.