typecheck fix

This commit is contained in:
Dustin Loring 2024-12-07 16:34:08 -05:00
parent b6f6f187fd
commit 7ee3bea2a0

View File

@ -3,25 +3,29 @@ import { AnimatePresence, cubicBezier, motion } from 'framer-motion';
interface SendButtonProps { interface SendButtonProps {
show: boolean; show: boolean;
isStreaming?: boolean; isStreaming?: boolean;
disabled?: boolean;
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void; onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
onImagesSelected?: (images: File[]) => void; onImagesSelected?: (images: File[]) => void;
} }
const customEasingFn = cubicBezier(0.4, 0, 0.2, 1); const customEasingFn = cubicBezier(0.4, 0, 0.2, 1);
export const SendButton = ({ show, isStreaming, onClick }: SendButtonProps) => { export const SendButton = ({ show, isStreaming, disabled, onClick }: SendButtonProps) => {
return ( return (
<AnimatePresence> <AnimatePresence>
{show ? ( {show ? (
<motion.button <motion.button
className="absolute flex justify-center items-center top-[18px] right-[22px] p-1 bg-accent-500 hover:brightness-94 color-white rounded-md w-[34px] h-[34px] transition-theme" className="absolute flex justify-center items-center top-[18px] right-[22px] p-1 bg-accent-500 hover:brightness-94 color-white rounded-md w-[34px] h-[34px] transition-theme disabled:opacity-50 disabled:cursor-not-allowed"
transition={{ ease: customEasingFn, duration: 0.17 }} transition={{ ease: customEasingFn, duration: 0.17 }}
initial={{ opacity: 0, y: 10 }} initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }} animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 10 }} exit={{ opacity: 0, y: 10 }}
disabled={disabled}
onClick={(event) => { onClick={(event) => {
event.preventDefault(); event.preventDefault();
if (!disabled) {
onClick?.(event); onClick?.(event);
}
}} }}
> >
<div className="text-lg"> <div className="text-lg">