GridEditModal.jsx 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. import React from 'react';
  2. import {
  3. Modal, ModalHeader, ModalBody, ModalFooter,
  4. } from 'reactstrap';
  5. export default class GridEditModal extends React.PureComponent {
  6. constructor(props) {
  7. super(props);
  8. this.state = {
  9. show: false,
  10. };
  11. this.show = this.show.bind(this);
  12. this.hide = this.hide.bind(this);
  13. this.cancel = this.cancel.bind(this);
  14. }
  15. show() {
  16. this.setState({ show: true });
  17. }
  18. hide() {
  19. this.setState({ show: false });
  20. }
  21. cancel() {
  22. this.hide();
  23. }
  24. showBgCols() {
  25. const cols = [];
  26. for (let i = 0; i < 12; i++) {
  27. // [bg-light:TODO support dark mode by GW-3037]
  28. cols.push(<div className="bg-light grid-bg-col col-1">t</div>);
  29. }
  30. return cols;
  31. }
  32. showEditableCols() {
  33. const cols = [];
  34. for (let i = 0; i < 12; i++) {
  35. // [bg-light:TODO support dark mode by GW-3037]
  36. cols.push(<div className="bg-dark grid-bg-col col-1"></div>);
  37. }
  38. return cols;
  39. }
  40. render() {
  41. return (
  42. <Modal isOpen={this.state.show} toggle={this.cancel} size="xl">
  43. <ModalHeader tag="h4" toggle={this.cancel} className="bg-primary text-light">
  44. Edit Grid
  45. </ModalHeader>
  46. <ModalBody className="">
  47. <div className="container">
  48. <div className="row">
  49. <div className="col-3">
  50. <h5>Phone</h5>
  51. <div className="device-container"></div>
  52. <h5>Tablet</h5>
  53. <div className="device-container"></div>
  54. <h5>Desktop</h5>
  55. <div className="device-container"></div>
  56. <h5>Large Desktop</h5>
  57. <div className="device-container"></div>
  58. </div>
  59. <div className="col-9">
  60. <div className="row h-100">
  61. {this.showBgCols()}
  62. </div>
  63. <div className="row w-100 h-100 position-absolute grid-editable-row">
  64. <div className="bg-dark grid-editable-col col-3"></div>
  65. <div className="bg-dark grid-editable-col col-5"></div>
  66. <div className="bg-dark grid-editable-col col-4"></div>
  67. </div>
  68. </div>
  69. {/* <div className="col-9">
  70. <div className="position-absolute">
  71. <div className="row h-100 flex-nowrap overflow-auto">{this.showBgCols()}</div>
  72. <div className="position-relative">
  73. <div className="row h-100 flex-nowrap overflow-auto">
  74. <div className="bg-dark grid-editable-col col-3"></div>
  75. <div className="bg-dark grid-editable-col col-5"></div>
  76. <div className="bg-dark grid-editable-col col-4"></div>
  77. </div>
  78. </div>
  79. </div> */}
  80. {/* <div className="offset-3 col-9 position-absolute">
  81. <div className="row h-100 flex-nowrap overflow-auto">{this.showBgCols()}</div>
  82. </div>
  83. <div className="col-9 position-relative">
  84. <div className="row h-100 flex-nowrap overflow-auto">
  85. <div className="bg-dark grid-editable-col col-3"></div>
  86. <div className="bg-dark grid-editable-col col-5"></div>
  87. <div className="bg-dark grid-editable-col col-4"></div>
  88. </div>
  89. </div> */}
  90. </div>
  91. {/* <div className="col-9 position-relative">
  92. <div className="row h-100 flex-nowrap overflow-auto">
  93. <div className="bg-dark grid-editable-col col-3"></div>
  94. <div className="bg-dark grid-editable-col col-5"></div>
  95. <div className="bg-dark grid-editable-col col-4"></div>
  96. </div>
  97. </div> */}
  98. {/* </div> */}
  99. </div>
  100. {/* <div className="container position-relative p-4">
  101. <div className="row">
  102. <div className="col-3">
  103. <h5>Phone</h5>
  104. <div className="device-container"></div>
  105. <h5>Tablet</h5>
  106. <div className="device-container"></div>
  107. <h5>Desktop</h5>
  108. <div className="device-container"></div>
  109. <h5>Large Desktop</h5>
  110. <div className="device-container"></div>
  111. </div>
  112. <div className="col-9">
  113. <div className="row h-100 flex-nowrap overflow-auto">
  114. {/* [bg-dark:TODO support dark mode by GW-3037] */}
  115. {/* [Just an example to check if bg-cols and editable-cols fit] */}
  116. {/* <div className="bg-dark grid-editable-col col-3"></div>
  117. <div className="bg-dark grid-editable-col col-5"></div>
  118. <div className="bg-dark grid-editable-col col-4"></div>
  119. </div>
  120. </div>
  121. </div>
  122. </div> */}
  123. </ModalBody>
  124. <ModalFooter className="grw-modal-footer">
  125. <div className="ml-auto">
  126. <button type="button" className="mr-2 btn btn-secondary" onClick={this.cancel}>Cancel</button>
  127. <button type="button" className="btn btn-primary">Done</button>
  128. </div>
  129. </ModalFooter>
  130. </Modal>
  131. );
  132. }
  133. }