import type { FormEvent } from 'react'; import { useCallback, useState } from 'react'; import { Button } from '../components/core/Button'; import type { InputProps } from '../components/core/Input'; import { Input } from '../components/core/Input'; import { HStack } from '../components/core/Stacks'; export interface PromptProps { onHide: () => void; onResult: (value: string) => void; label: InputProps['label']; name: InputProps['name']; defaultValue: InputProps['defaultValue']; } export function Prompt({ onHide, label, name, defaultValue, onResult }: PromptProps) { const [value, setValue] = useState(defaultValue ?? ''); const handleSubmit = useCallback( (e: FormEvent) => { e.preventDefault(); onHide(); onResult(value); }, [onHide, onResult, value], ); return (
); }