ArchiveCreateModal.jsx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import React, { useState } from 'react';
  2. import PropTypes from 'prop-types';
  3. import { withTranslation } from 'react-i18next';
  4. import {
  5. Modal, ModalHeader, ModalBody, ModalFooter,
  6. } from 'reactstrap';
  7. const ArchiveCreateModal = (props) => {
  8. const { t } = props;
  9. const [isCommentDownload, setIsCommentDownload] = useState(false);
  10. const [isFileDownload, setIsFileDownload] = useState(false);
  11. const [isSubordinatedPageDownload, setIsSubordinatedPageDownload] = useState(false);
  12. function changeIsCommentDownloadHandler() {
  13. setIsCommentDownload(!isCommentDownload);
  14. }
  15. function changeIsFileDownloadHandler() {
  16. setIsFileDownload(!isFileDownload);
  17. }
  18. function changeIsSubordinatedPageDownloadHandler() {
  19. setIsSubordinatedPageDownload(!isSubordinatedPageDownload);
  20. }
  21. function closeModalHandler() {
  22. if (props.onClose == null) {
  23. return;
  24. }
  25. props.onClose();
  26. }
  27. return (
  28. <Modal size="lg" isOpen={props.isOpen} toggle={closeModalHandler}>
  29. <ModalHeader tag="h4" toggle={closeModalHandler} className="bg-primary text-white">
  30. {t('Create Archive Page')}
  31. </ModalHeader>
  32. <ModalBody>
  33. <div className="form-group">
  34. <div className="custom-control custom-radio custom-control-inline ">
  35. <label>{t('File type')}: </label>
  36. </div>
  37. <div className="custom-control custom-radio custom-control-inline ">
  38. <input type="radio" className="custom-control-input" />
  39. <label className="custom-control-label">MarkDown(.md)</label>
  40. </div>
  41. <div className="custom-control custom-radio custom-control-inline">
  42. <input type="radio" className="custom-control-input" />
  43. <label className="custom-control-label">PDF(.pdf)</label>
  44. </div>
  45. </div>
  46. <div className="custom-control custom-checkbox custom-checkbox-warning">
  47. <input
  48. className="custom-control-input"
  49. name="comment"
  50. id="commentFile"
  51. type="checkbox"
  52. checked={isCommentDownload}
  53. onChange={changeIsCommentDownloadHandler}
  54. />
  55. <label className="custom-control-label" htmlFor="commentFile">
  56. {t('Include Comment')}
  57. </label>
  58. </div>
  59. <div className="custom-control custom-checkbox custom-checkbox-warning">
  60. <input
  61. className="custom-control-input"
  62. id="downloadFile"
  63. type="checkbox"
  64. checked={isFileDownload}
  65. onChange={changeIsFileDownloadHandler}
  66. />
  67. <label className="custom-control-label" htmlFor="downloadFile">{t('Include Attachment File')}</label>
  68. </div>
  69. <div className="custom-control custom-checkbox custom-checkbox-warning">
  70. <input
  71. className="custom-control-input"
  72. id="subordinatedFile"
  73. type="checkbox"
  74. checked={isSubordinatedPageDownload}
  75. onChange={changeIsSubordinatedPageDownloadHandler}
  76. />
  77. <label className="custom-control-label" htmlFor="subordinatedFile">
  78. {t('Include Subordinated Page')}
  79. </label>
  80. </div>
  81. </ModalBody>
  82. <ModalFooter>
  83. <button type="button">Done</button>
  84. </ModalFooter>
  85. </Modal>
  86. );
  87. };
  88. ArchiveCreateModal.propTypes = {
  89. t: PropTypes.func.isRequired, // i18next
  90. isOpen: PropTypes.bool.isRequired,
  91. onClose: PropTypes.func,
  92. };
  93. export default withTranslation()(ArchiveCreateModal);