Alternative web application for the pdsadmin command
at main 29 lines 600 B view raw
1import type { ComponentProps } from "react"; 2 3import { cn } from "../../utils/cn"; 4 5type Props = ComponentProps<"button"> & { 6 loading?: boolean; 7 loadingClassName?: string; 8}; 9 10export function Button({ 11 loading, 12 loadingClassName, 13 children, 14 ...props 15}: Props) { 16 return ( 17 <button disabled={loading} {...props}> 18 {loading && ( 19 <div 20 className={cn( 21 "loading loading-spinner loading-sm absolute", 22 loadingClassName, 23 )} 24 ></div> 25 )} 26 <span className={cn(loading && "opacity-0")}>{children}</span> 27 </button> 28 ); 29}