import { FC, FormEvent, SyntheticEvent, useState } from 'react' import { result } from '../../../common/result' import { createWish, Wish } from '../models' interface CreateWishProps { onFocus: () => void onSubmit: (wish: Wish) => void } const CreateWish: FC = (props) => { const [focused, setFocused] = useState(false) const onSubmit = (e: SyntheticEvent) => { e.preventDefault() const target = e.target as typeof e.target & { wishName: { value: string } wishDescription: { value?: string } wishLink: { value?: string } } const wishRes = createWish( target.wishName.value, target.wishDescription.value, target.wishLink.value ) result.tap(wishRes, (wish) => { props.onSubmit(wish) }) } return (
setFocused(true)}>
) } const InnerWishPrompt: FC = (props) => { return (