feat(admin-ui): codemod @nstart/ui → @/ui (Stage 2.2)

This commit is contained in:
Александр Зимин
2026-05-10 22:17:06 +00:00
parent 0710efb8ce
commit b7d2fbd7ce
34 changed files with 398 additions and 92 deletions
+25 -2
View File
@@ -61,21 +61,44 @@ export type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> &
asChild?: boolean
leftIcon?: React.ReactNode
rightIcon?: React.ReactNode
/** Loading state — disables button + replaces leftIcon с inline spinner. */
loading?: boolean
}
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
function Button(
{ className, variant, size, asChild, leftIcon, rightIcon, children, ...props },
{
className,
variant,
size,
asChild,
leftIcon,
rightIcon,
loading,
disabled,
children,
...props
},
ref,
) {
const Comp = asChild ? Slot : 'button'
const renderedLeftIcon = loading ? (
<svg className="animate-spin size-3.5" viewBox="0 0 24 24" aria-hidden>
<circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" strokeOpacity="0.25" strokeWidth="4" />
<path d="M4 12a8 8 0 0 1 8-8" fill="none" stroke="currentColor" strokeWidth="4" strokeLinecap="round" />
</svg>
) : (
leftIcon
)
return (
<Comp
ref={ref}
className={cn(buttonVariants({ variant, size }), className)}
disabled={disabled || loading}
aria-busy={loading || undefined}
{...props}
>
{leftIcon}
{renderedLeftIcon}
{children}
{rightIcon}
</Comp>