import type { ButtonHTMLAttributes, InputHTMLAttributes, ReactNode } from 'react'
import { statusTone, statusKey } from '../payments/status'
import { useI18n } from '../i18n'
import type { PaymentStatus } from '../types'
export function Button({ children, ...rest }: ButtonHTMLAttributes & { children: ReactNode }) {
return (
)
}
interface FieldProps extends InputHTMLAttributes {
label: string
id: string
error?: string
}
export function Field({ label, id, error, ...rest }: FieldProps) {
const errId = error ? `${id}-error` : undefined
return (
{error && (
{error}
)}
)
}
export function StatusBadge({ status }: { status: PaymentStatus }) {
const { t } = useI18n()
return (
{t(statusKey(status) as never)}
)
}
export function Callout({ tone = 'info', children }: { tone?: 'info' | 'ok' | 'bad' | 'warn'; children: ReactNode }) {
return (
{children}
)
}
export function Spinner({ label }: { label: string }) {
return (
{label}
)
}