Template
12 lines
359 B
TypeScript
12 lines
359 B
TypeScript
import { clsx, type ClassValue } from "clsx"
|
|
import { twMerge } from "tailwind-merge"
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs))
|
|
}
|
|
|
|
export const truncate = (text: string, maxLength: number): string => {
|
|
if (!text) return '';
|
|
if (text.length <= maxLength) return text;
|
|
return text.slice(0, maxLength).trim() + '...';
|
|
}; |