feat(admin-ui): codemod @nstart/ui → @/ui (Stage 2.2)
This commit is contained in:
@@ -15,6 +15,8 @@ const alertVariants = cva(
|
||||
success: 'border-l-green bg-green-bg text-ink',
|
||||
warning: 'border-l-warn bg-warn-bg text-ink',
|
||||
danger: 'border-l-pink bg-pink-bg text-ink',
|
||||
// Alias для nstart-compat: error === danger визуально.
|
||||
error: 'border-l-pink bg-pink-bg text-ink',
|
||||
neutral: 'border-l-line bg-surface-2 text-ink',
|
||||
},
|
||||
},
|
||||
@@ -25,14 +27,21 @@ const alertVariants = cva(
|
||||
export type AlertProps = React.HTMLAttributes<HTMLDivElement> &
|
||||
VariantProps<typeof alertVariants> & {
|
||||
title?: React.ReactNode
|
||||
/** Right-aligned slot для action button(s) inside alert. */
|
||||
action?: React.ReactNode
|
||||
}
|
||||
|
||||
export const Alert = React.forwardRef<HTMLDivElement, AlertProps>(
|
||||
function Alert({ className, variant, title, children, ...props }, ref) {
|
||||
function Alert({ className, variant, title, action, children, ...props }, ref) {
|
||||
return (
|
||||
<div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props}>
|
||||
{title && <div className="font-medium mb-0.5">{title}</div>}
|
||||
<div className="text-ink-2 text-[13px] leading-snug">{children}</div>
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<div className="min-w-0 flex-1">
|
||||
{title && <div className="font-medium mb-0.5">{title}</div>}
|
||||
<div className="text-ink-2 text-[13px] leading-snug">{children}</div>
|
||||
</div>
|
||||
{action && <div className="shrink-0 flex items-center gap-2">{action}</div>}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user