import { Suspense, useState } from "react"; import { BottomSheet } from "react-spring-bottom-sheet"; import { atom, useAtom } from "jotai"; import { useRouter, Routes } from "blitz"; import "react-spring-bottom-sheet/dist/style.css"; import NewMessageArea from "./new-message-area"; export const bottomSheetOpenAtom = atom(false); export default function NewMessageBottomSheet() { const router = useRouter(); const [isOpen, setIsOpen] = useAtom(bottomSheetOpenAtom); const [recipient, setRecipient] = useState(""); return ( setIsOpen(false)} snapPoints={({ maxHeight }) => maxHeight / 2} header={
New Message
} >
To: setRecipient(event.target.value)} className="bg-none border-none outline-none flex-1 text-black" />
{ router.push(Routes.ConversationPage({ recipient })).then(() => setIsOpen(false)); }} />
); }