From 4f26582de29db9272dcdf5a6087d58f73e7cbcb8 Mon Sep 17 00:00:00 2001 From: waterWang Date: Fri, 7 Aug 2026 06:23:12 +0800 Subject: [PATCH] refactor: collapse duplicate cn helpers into canonical lib/utils/cn.ts (Closes #1421) Collapse the three identical Tailwind classnames helpers into a single canonical implementation in lib/utils/cn.ts. lib/utils.ts and lib/utils/index.ts now re-export from it instead of duplicating the same twMerge(clsx(...)) logic. Runtime behavior is unchanged; all cn-related tests pass. --- lib/utils.ts | 7 +------ lib/utils/index.ts | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/utils.ts b/lib/utils.ts index 365058ce..607cb86e 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -1,6 +1 @@ -import { type ClassValue, clsx } from "clsx"; -import { twMerge } from "tailwind-merge"; - -export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)); -} +export { cn } from "./utils/cn"; diff --git a/lib/utils/index.ts b/lib/utils/index.ts index 37295e1c..c25627d5 100644 --- a/lib/utils/index.ts +++ b/lib/utils/index.ts @@ -1,6 +1 @@ -import { clsx } from "clsx"; -import { twMerge } from "tailwind-merge"; - -export function cn(...inputs: Parameters) { - return twMerge(clsx(inputs)); -} +export { cn } from "./cn";