Add React editor project
This commit is contained in:
+6
-5
@@ -1,11 +1,12 @@
|
||||
import { clsx, type ClassValue } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
import { clsx, type ClassValue } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
export function truncate(text: string, max = 80): string {
|
||||
if (!text) return "";
|
||||
return text.length > max ? text.slice(0, max - 1).trimEnd() + "…" : text;
|
||||
export function truncate(str: string, maxLength: number): string {
|
||||
if (!str) return '';
|
||||
if (str.length <= maxLength) return str;
|
||||
return str.slice(0, maxLength).trim() + '...';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user