Initial commit from Create Next App
This commit is contained in:
24
components/form-message.tsx
Normal file
24
components/form-message.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
export type Message =
|
||||
| { success: string }
|
||||
| { error: string }
|
||||
| { message: string };
|
||||
|
||||
export function FormMessage({ message }: { message: Message }) {
|
||||
return (
|
||||
<div className="flex flex-col gap-2 w-full max-w-md text-sm">
|
||||
{"success" in message && (
|
||||
<div className="text-foreground border-l-2 border-foreground px-4">
|
||||
{message.success}
|
||||
</div>
|
||||
)}
|
||||
{"error" in message && (
|
||||
<div className="text-destructive-foreground border-l-2 border-destructive-foreground px-4">
|
||||
{message.error}
|
||||
</div>
|
||||
)}
|
||||
{"message" in message && (
|
||||
<div className="text-foreground border-l-2 px-4">{message.message}</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user