import React, {useState, useEffect} from "react"; import { ButtonUi, ButtonUiType } from "../../shared/UI/ButtonUi"; import Modal from 'react-bootstrap/Modal'; import Form from 'react-bootstrap/Form'; type auctionItem = { number: number, name: string, receptionDate: string, startDate: string, status: string } interface AddAuctionModalProps { showModal: boolean, onHide: () => void, currentAuction: auctionItem, editAuctionItem: (newAuctionName:string, currentEditAuctionId:number) => void } export const EditAuctionModal:React.FC = ({showModal, onHide, currentAuction, editAuctionItem}) => { const [newAuctionName, setNewAuctionName] = useState('') useEffect(() => { currentAuction ? setNewAuctionName(currentAuction.name) : setNewAuctionName('') }, [currentAuction]) const editAuction = () => { editAuctionItem(newAuctionName, currentAuction.number) onHide() } return ( Редактировать аукцион №{currentAuction.number}
Название аукциона* setNewAuctionName(e.target.value)} autoFocus /> Комментарий к аукциону
) }