260703_01_FST: First Commit
This commit is contained in:
12
.tooling/lib/as-child.tsx
Normal file
12
.tooling/lib/as-child.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { cloneElement, isValidElement, type HTMLAttributes, type ReactNode } from "react";
|
||||
|
||||
export function renderAsChild(
|
||||
asChild: boolean | undefined,
|
||||
children: ReactNode,
|
||||
props: HTMLAttributes<HTMLElement>
|
||||
) {
|
||||
if (asChild && isValidElement<HTMLAttributes<HTMLElement>>(children)) {
|
||||
return cloneElement(children, { ...props, ...children.props });
|
||||
}
|
||||
return <span {...props}>{children}</span>;
|
||||
}
|
||||
6
.tooling/lib/utils.ts
Normal file
6
.tooling/lib/utils.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { type ClassValue, clsx } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
Reference in New Issue
Block a user