mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 11:56:00 +00:00
rename saved file
This commit is contained in:
29
packages/web/src/modals/InputTextModal.js
Normal file
29
packages/web/src/modals/InputTextModal.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import React from 'react';
|
||||
import ModalBase from './ModalBase';
|
||||
import { FormTextField, FormSubmit, FormButton } from '../utility/forms';
|
||||
import ModalHeader from './ModalHeader';
|
||||
import ModalContent from './ModalContent';
|
||||
import ModalFooter from './ModalFooter';
|
||||
import { FormProvider } from '../utility/FormProvider';
|
||||
|
||||
export default function InputTextModal({ header, label, value, modalState, onConfirm }) {
|
||||
const handleSubmit = async (values) => {
|
||||
const { value } = values;
|
||||
modalState.close();
|
||||
onConfirm(value);
|
||||
};
|
||||
return (
|
||||
<ModalBase modalState={modalState}>
|
||||
<ModalHeader modalState={modalState}>{header}</ModalHeader>
|
||||
<FormProvider initialValues={{ value }}>
|
||||
<ModalContent>
|
||||
<FormTextField label={label} name="value" focused />
|
||||
</ModalContent>
|
||||
<ModalFooter>
|
||||
<FormButton value="Cancel" onClick={() => modalState.close()} />
|
||||
<FormSubmit value="OK" onClick={handleSubmit} />
|
||||
</ModalFooter>
|
||||
</FormProvider>
|
||||
</ModalBase>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user