]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/components/techniques/Dialog.js
basic content editing
[alttp.git] / resources / js / components / techniques / Dialog.js
diff --git a/resources/js/components/techniques/Dialog.js b/resources/js/components/techniques/Dialog.js
new file mode 100644 (file)
index 0000000..96eaba5
--- /dev/null
@@ -0,0 +1,45 @@
+import PropTypes from 'prop-types';
+import React from 'react';
+import { Modal } from 'react-bootstrap';
+import { useTranslation } from 'react-i18next';
+
+import Form from './Form';
+import LanguageSwitcher from '../app/LanguageSwitcher';
+
+const Dialog = ({
+       content,
+       language,
+       onHide,
+       onSubmit,
+       show,
+}) => {
+       const { t } = useTranslation();
+
+       return <Modal onHide={onHide} show={show} size="lg">
+               <Modal.Header closeButton>
+                       <Modal.Title>
+                               {t('content.edit')}
+                       </Modal.Title>
+                       <div className="mx-3">
+                               <LanguageSwitcher />
+                       </div>
+               </Modal.Header>
+               <Form
+                       content={content}
+                       language={language}
+                       onCancel={onHide}
+                       onSubmit={onSubmit}
+               />
+       </Modal>;
+};
+
+Dialog.propTypes = {
+       content: PropTypes.shape({
+       }),
+       language: PropTypes.string,
+       onHide: PropTypes.func,
+       onSubmit: PropTypes.func,
+       show: PropTypes.bool,
+};
+
+export default Dialog;