mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
## Problem We now export components under a subpath in ui-patterns to avoid barrel files as they slow down every tools (from IDE to linters, etc.) and may also affect bundles our users have to download. ## Solution - Remove the UI patterns index file - Fix invalid impors
33 lines
810 B
TypeScript
33 lines
810 B
TypeScript
import { AnimatePresence, motion } from 'framer-motion'
|
|
import { Admonition } from 'ui-patterns/admonition'
|
|
|
|
interface FormMessageProps {
|
|
message: string
|
|
type?: 'error' | 'success'
|
|
children?: React.ReactNode
|
|
}
|
|
|
|
function FormMessage({ message = 'error', type, children }: FormMessageProps) {
|
|
return (
|
|
<AnimatePresence>
|
|
{message && (
|
|
<motion.div
|
|
initial={{ opacity: 0, height: 0 }}
|
|
animate={{ opacity: 1, height: 'auto' }}
|
|
exit={{ opacity: 0, height: 0 }}
|
|
>
|
|
<Admonition
|
|
type={type === 'error' ? 'destructive' : 'default'}
|
|
className="mt-2"
|
|
title={message}
|
|
>
|
|
{children}
|
|
</Admonition>
|
|
</motion.div>
|
|
)}
|
|
</AnimatePresence>
|
|
)
|
|
}
|
|
|
|
export default FormMessage
|