import {
Button,
Container,
Drawer,
Group,
Stack,
Textarea,
} from '@mantine/core';
import { useForm } from '@mantine/form';
import { notifications } from '@mantine/notifications';
import useUpdateNote from '../../lib/mutations/useUpdateNote';
import { UPDATE_OVERLAY_PROPS } from '@/styles/overlays';
import { BsExclamation } from 'react-icons/bs';
interface Props {
isOpen: boolean;
onClose: () => void;
noteCardId: string;
note: string;
}
export default function EditNoteDrawer(props: Props) {
const updateNote = useUpdateNote();
const form = useForm({
initialValues: {
note: props.note,
},
});
const handleUpdateNote = (e: React.FormEvent) => {
e.preventDefault();
updateNote.mutate(
{
cardId: props.noteCardId,
note: form.values.note,
},
{
onError: () => {
notifications.show({
message: 'Could not update note',
position: 'top-center',
color: 'red',
title: 'Error',
loading: false,
autoClose: false,
withCloseButton: true,
icon: ,
});
},
onSettled: () => {
props.onClose();
},
},
);
};
return (
{
props.onClose();
form.reset();
}}
withCloseButton={false}
position="bottom"
padding={'sm'}
size={'xs'}
overlayProps={UPDATE_OVERLAY_PROPS}
onClick={(e) => e.stopPropagation()}
>
Edit Note
);
}