mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
* component clean up * optically center * docs and type size * code badge variant * sensible defaults * fix product menu flex * badge sweep * new project badges * logs * compute badge * studio badge sweep * www sweep * docs sweep * clean up * fixes * cleanup * fixes * better docs * fixes * misc fixes * consistency * Minor fixes for issues i found * simplify mt-0 * mt simplification * remaining optical alignment --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { AnimatePresence, motion } from 'framer-motion'
|
|
|
|
interface FormFooterChangeBadgeProps {
|
|
formState: {
|
|
dirtyFields: Record<string, boolean>
|
|
}
|
|
}
|
|
export const FormFooterChangeBadge = ({ formState }: FormFooterChangeBadgeProps) => {
|
|
return (
|
|
<AnimatePresence mode="wait">
|
|
{Object.keys(formState.dirtyFields).length > 0 && (
|
|
<motion.div
|
|
initial={{ opacity: 0, scale: 0.9 }}
|
|
animate={{ opacity: 1, scale: 1 }}
|
|
exit={{ opacity: 0, scale: 0.9 }}
|
|
transition={{ duration: 0.2 }}
|
|
>
|
|
<motion.div
|
|
animate={{
|
|
scale: [1, 1.05, 1],
|
|
transition: { duration: 0.3 },
|
|
}}
|
|
>
|
|
<p className="text-sm text-foreground-lighter">
|
|
<motion.span
|
|
key={Object.keys(formState.dirtyFields).length}
|
|
initial={{ opacity: 0, scale: 0.9 }}
|
|
animate={{ opacity: 1, scale: 1 }}
|
|
exit={{ opacity: 0, scale: 0.9 }}
|
|
transition={{ duration: 0.1 }}
|
|
>
|
|
{Object.keys(formState.dirtyFields).length === 1
|
|
? '1 change to review'
|
|
: `${Object.keys(formState.dirtyFields).length} changes to review`}
|
|
</motion.span>
|
|
</p>
|
|
</motion.div>
|
|
</motion.div>
|
|
)}
|
|
</AnimatePresence>
|
|
)
|
|
}
|