File tree Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ import { useEffect, useState } from 'react';
3636 * }
3737 * ```
3838 *
39- * @see {@link https://web.dev/articles/debounce| 디바운스에 대해 자세히 알아보기 }
39+ * @see {@link https://web.dev/articles/debounce 디바운스에 대해 자세히 알아보기 }
4040 * @category Hooks
4141 */
4242export function useDebounce < T > ( value : T , delay : number = 3000 ) : T {
Original file line number Diff line number Diff line change 11import { clsx , type ClassValue } from 'clsx' ;
22import { twMerge } from 'tailwind-merge' ;
33
4+ /**
5+ * Tailwind CSS 클래스들을 병합하는 유틸리티 함수입니다.
6+ *
7+ * - clsx를 사용하여 조건부 클래스를 처리합니다.
8+ * - tailwind-merge를 사용하여 Tailwind 클래스 충돌을 해결합니다.
9+ *
10+ * @param inputs - 병합할 클래스들의 배열. ClassValue 타입은 문자열, 객체, 배열 등을 포함할 수 있습니다.
11+ * @returns 병합된 클래스 문자열
12+ *
13+ * @example
14+ * ```tsx
15+ * // 버튼 컴포넌트에서의 사용 예시
16+ * const buttonVariants = cva(
17+ * 'inline-flex items-center justify-center',
18+ * {
19+ * variants: {
20+ * variant: {
21+ * primary: 'bg-violet-500 hover:bg-violet-600',
22+ * // ...
23+ * },
24+ * size: {
25+ * sm: 'h-11 text-2xl',
26+ * // ...
27+ * }
28+ * },
29+ * defaultVariants: {
30+ * variant: 'primary',
31+ * size: 'sm'
32+ * }
33+ * }
34+ * );
35+ *
36+ * const Button = ({ className, variant, size, ...props }) => {
37+ * return (
38+ * <button
39+ * className={cn(
40+ * buttonVariants({ variant, size, className }),
41+ * )}
42+ * {...props}
43+ * />
44+ * );
45+ * };
46+ * ```
47+ *
48+ * @see {@link https://github.com/lukeed/clsx clsx }
49+ * @see {@link https://github.com/dcastil/tailwind-merge tailwind-merge }
50+ * @see {@link https://github.com/shadcn/ui shadcn/ui }
51+ * @category Utils
52+ */
453export function cn ( ...inputs : ClassValue [ ] ) {
554 return twMerge ( clsx ( inputs ) ) ;
655}
You can’t perform that action at this time.
0 commit comments