mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-06-05 19:15:30 -04:00
chore: update shadcn primitives
This commit is contained in:
+2
-16
@@ -1,20 +1,6 @@
|
||||
import { clsx, type ClassValue } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export const cn = (...inputs: ClassValue[]) => {
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
};
|
||||
|
||||
/**
|
||||
* Recursively extracts plain text content from React nodes.
|
||||
* Replacement for the `react-to-text` package.
|
||||
*/
|
||||
export const getTextContent = (node: React.ReactNode): string => {
|
||||
if (node == null || typeof node === "boolean") return "";
|
||||
if (typeof node === "string" || typeof node === "number") return String(node);
|
||||
if (Array.isArray(node)) return node.map(getTextContent).join("");
|
||||
if (typeof node === "object" && "props" in node) {
|
||||
return getTextContent((node as React.ReactElement<{ children?: React.ReactNode }>).props.children);
|
||||
}
|
||||
return "";
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user