import type { KeyboardEvent } from "react"; import { Icon } from "./Icon"; type Props = { text: string; isEditing: boolean; editValue: string; onEditChange: (value: string) => void; onBeginEdit: () => void; onSubmitEdit: () => void | Promise; onCancelEdit: () => void; }; export function UserBubble({ text, isEditing, editValue, onEditChange, onBeginEdit, onSubmitEdit, onCancelEdit, }: Props) { const handleKeyDown = (e: KeyboardEvent) => { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); onSubmitEdit(); } if (e.key === "Escape") { e.preventDefault(); onCancelEdit(); } }; return (
{!isEditing ? (
) : (