34 lines
952 B
TypeScript
34 lines
952 B
TypeScript
interface Props {
|
|
kind: 'success' | 'error'
|
|
/** Для success: «Готово · имя · КБ»; для error: текст ошибки. */
|
|
text: string
|
|
}
|
|
|
|
/** Строка результата над/под кнопкой: успех (зелёный) или ошибка (красный). */
|
|
export default function StatusMessage({ kind, text }: Props) {
|
|
const ok = kind === 'success'
|
|
return (
|
|
<p
|
|
role="status"
|
|
aria-live="polite"
|
|
className={`mt-5 flex items-center gap-2 text-sm font-medium ${
|
|
ok ? 'text-ok' : 'text-err'
|
|
}`}
|
|
>
|
|
<svg
|
|
viewBox="0 0 20 20"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
strokeWidth="2"
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
className="h-4.5 w-4.5 shrink-0"
|
|
aria-hidden="true"
|
|
>
|
|
{ok ? <path d="M4 10.5l4 4 8-9" /> : <path d="M5 5l10 10M15 5 5 15" />}
|
|
</svg>
|
|
{text}
|
|
</p>
|
|
)
|
|
}
|