Pressidian
花园入口
笔记
项目
关于
实验室
GitHub
花园入口
笔记
项目
关于
实验室
GitHub

KNOWLEDGE PATHS

笔记库
当前位置
笔记库/前端/项目笔记/代达罗斯/模式

cn

1 分钟阅读 · Note

目录树 578 篇

            • 表单最佳实践指南
            • 双层级导航结构
            • 以schema为中心的
            • 异步三态切换
            • 用neverthrow进行错误处理
            • Anatomy
            • cn
            • LoadingState&useList的组合
            • procedure中的service位置
            • scrollbar-gutter
            • TailwindCSS
            • TanStack Router 路由模式
            • useDebounce
            • useForm
            • void
          • 项目待做
          • 性能优化
          • UI设计
      • 前端技术栈
    • 笔记目录
    • CLAUDE.md
    • Vue 组件与 Render 函数

关联笔记 6

↗表单最佳实践指南同一路径↗双层级导航结构同一路径↗以schema为中心的同一路径↗异步三态切换同一路径↗用neverthrow进行错误处理同一路径↗Anatomy同一路径
  • cn

cn

将classname中存在的表达式转换为字符串,而不是使用:

`px-2 ${ ClassName }` 

的形式去拼接

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

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

import type { HTMLAttributes } from "react";
import { cn } from "@/lib/utils";

export const Card = function({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
  return <div className={cn("rounded-[10px] border border-[#ececef] dark:border-border bg-card text-card-foreground", className)} {...props} />;
};

export const CardHeader = function({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
  return <div className={cn("flex items-center justify-between px-[17px] py-4 border-b border-[#f4f4f5] dark:border-border", className)} {...props} />;
};

export const CardContent = function({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
  return <div className={cn("px-[17px] py-4", className)} {...props} />;
};