LinkEditModal.jsx 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. import React from 'react';
  2. import {
  3. Modal, ModalHeader, ModalBody,
  4. } from 'reactstrap';
  5. export default class LinkEditModal extends React.PureComponent {
  6. constructor(props) {
  7. super(props);
  8. this.state = {
  9. show: false,
  10. isUseRelativePath: false,
  11. };
  12. this.cancel = this.cancel.bind(this);
  13. this.toggleIsUseRelativePath = this.toggleIsUseRelativePath.bind(this);
  14. }
  15. show() {
  16. this.setState({ show: true });
  17. }
  18. cancel() {
  19. this.hide();
  20. }
  21. hide() {
  22. this.setState({
  23. show: false,
  24. });
  25. }
  26. toggleIsUseRelativePath() {
  27. this.setState({ isUseRelativePath: !this.state.isUseRelativePath });
  28. }
  29. renderPreview() {
  30. // TODO GW-2658
  31. }
  32. insertLinkIntoEditor() {
  33. // TODO GW-2659
  34. }
  35. render() {
  36. return (
  37. <Modal isOpen={this.state.show} toggle={this.cancel} size="lg">
  38. <ModalHeader tag="h4" toggle={this.cancel} className="bg-primary text-light">
  39. Edit Table
  40. </ModalHeader>
  41. <ModalBody className="container">
  42. <div className="row">
  43. <div className="col">
  44. <div className="form-gorup my-3">
  45. <label htmlFor="linkInput">Link</label>
  46. <div className="input-group">
  47. <input
  48. className="form-control"
  49. id="linkInput"
  50. type="text"
  51. placeholder="/foo/bar/31536000"
  52. aria-describedby="button-addon"
  53. />
  54. <div className="input-group-append">
  55. <button type="button" id="button-addon" className="btn btn-secondary">Preview</button>
  56. </div>
  57. </div>
  58. </div>
  59. <div className="d-block d-lg-none">
  60. { this.renderPreview }
  61. render preview
  62. </div>
  63. <div className="linkedit-tabs">
  64. <ul className="nav nav-tabs" role="tabist">
  65. <li className="nav-item">
  66. <a className="nav-link active" href="#Pukiwiki" role="tab" data-toggle="tab">Pukiwiki</a>
  67. </li>
  68. <li className="nav-item">
  69. <a className="nav-link" href="#Crowi" role="tab" data-toggle="tab">Crowi</a>
  70. </li>
  71. <li className="nav-item">
  72. <a className="nav-link" href="#MD" role="tab" data-toggle="tab">MD</a>
  73. </li>
  74. </ul>
  75. <div className="tab-content pt-3">
  76. <div id="Pukiwiki" className="tab-pane active" role="tabpanel">
  77. <form className="form-group">
  78. <div className="form-group">
  79. <label htmlFor="pukiwikiLink">Label</label>
  80. <input type="text" className="form-control" id="pukiwikiLink"></input>
  81. </div>
  82. <div>
  83. <span>URI</span>
  84. </div>
  85. <div className="form-inline">
  86. <div className="custom-control custom-checkbox custom-checkbox-info">
  87. <input
  88. className="custom-control-input"
  89. id="relativePath"
  90. type="checkbox"
  91. checked={this.state.isUseRelativePath}
  92. />
  93. <label
  94. className="custom-control-label"
  95. htmlFor="relativePath"
  96. onClick={this.toggleIsUseRelativePath}
  97. >
  98. Use relative path
  99. </label>
  100. </div>
  101. <button type="button" className="btn btn-primary ml-auto">Done</button>
  102. </div>
  103. </form>
  104. </div>
  105. <div id="Crowi" className="tab-pane" role="tabpanel">
  106. <form className="form-group">
  107. <div className="form-group">
  108. <label htmlFor="crowiLink">Label</label>
  109. <input type="text" className="form-control" id="crowiLink"></input>
  110. </div>
  111. <div>
  112. <span>URI</span>
  113. </div>
  114. <div className="d-flex">
  115. <button type="button" className="btn btn-primary ml-auto">Done</button>
  116. </div>
  117. </form>
  118. </div>
  119. <div id="MD" className="tab-pane" role="tabpanel">
  120. <form className="form-group">
  121. <div className="form-group">
  122. <label htmlFor="MDLink">Label</label>
  123. <input type="text" className="form-control" id="MDLink"></input>
  124. </div>
  125. <div>
  126. <span>URI</span>
  127. </div>
  128. <div className="form-inline">
  129. <div className="custom-control custom-checkbox custom-checkbox-info">
  130. <input
  131. className="custom-control-input"
  132. id="relativePath"
  133. type="checkbox"
  134. checked={this.state.isUseRelativePath}
  135. />
  136. <label
  137. className="custom-control-label"
  138. htmlFor="relativePath"
  139. onClick={this.toggleIsUseRelativePath}
  140. >
  141. Use relative path
  142. </label>
  143. </div>
  144. <button type="button" className="btn btn-primary ml-auto">Done</button>
  145. </div>
  146. </form>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. <div className="col d-none d-lg-block">
  152. { this.renderPreview }
  153. render preview
  154. </div>
  155. </div>
  156. </ModalBody>
  157. </Modal>
  158. );
  159. }
  160. }