main
tsx 25 lines 674 Bytes
Raw
1 import type { ReactElement } from 'react'
2 import './status.css'
3
4 export interface ErrorProps {
5 error: Error | string
6 className?: string
7 errorPrefix?: string
8 }
9
10 export function SmallError ({ error, className, errorPrefix }: ErrorProps): ReactElement {
11 return (
12 <small className={`Error ${className ?? ''}`}>{errorPrefix != null ? `${errorPrefix}: ` : ''}{error instanceof Error ? error.message : error}</small>
13 )
14 }
15
16 export interface SuccessProps {
17 message: string
18 className?: string
19 }
20
21 export function SmallSuccess ({ message, className }: SuccessProps): ReactElement {
22 return (
23 <small className={`Success ${className ?? ''}`}>{message}</small>
24 )
25 }