Просмотр исходного кода

Merge pull request #2535 from weseek/imprv/gw3189-set-all-division-pattern-new

Imprv/gw3189 set all division pattern new
Yuki Takei 5 лет назад
Родитель
Сommit
7377caf7e9

+ 19 - 30
src/client/js/components/PageEditor/GridEditModal.jsx

@@ -124,40 +124,29 @@ export default class GridEditModal extends React.PureComponent {
 }
 
 function GridDivisionMenu() {
+  const gridDivisions = geu.mappingAllGridDivisionPatterns;
   return (
     <div className="container">
       <div className="row">
-        {/* TODO: add other grid patterns by GW-3189 */}
-        <div className="col-md-4 text-center">
-          <h6 className="dropdown-header">2分割</h6>
-          <a className="dropdown-item" href="#">
-            <div className="row">
-              <span className="bg-info col-6 border">6</span>
-              <span className="bg-info col-6 border">6</span>
-            </div>
-          </a>
-        </div>
-        <div className="col-md-4 text-center">
-          <h6 className="dropdown-header">3分割</h6>
-          <a className="dropdown-item" href="#">
-            <div className="row">
-              <span className="bg-info col-4 border">4</span>
-              <span className="bg-info col-4 border">4</span>
-              <span className="bg-info col-4 border">4</span>
-            </div>
-          </a>
-        </div>
-        <div className="col-md-4 text-center">
-          <h6 className="dropdown-header">4分割</h6>
-          <a className="dropdown-item" href="#">
-            <div className="row">
-              <span className="bg-info col-3 border">3</span>
-              <span className="bg-info col-3 border">3</span>
-              <span className="bg-info col-3 border">3</span>
-              <span className="bg-info col-3 border">3</span>
+        {gridDivisions.map((gridDivion, i) => {
+          return (
+            <div className="col-md-4 text-center">
+              <h6 className="dropdown-header">{i + 2}分割</h6>
+              {gridDivion.map((gridOneDivision) => {
+                return (
+                  <a className="dropdown-item" href="#">
+                    <div className="row">
+                      {gridOneDivision.map((gtd) => {
+                        const className = `bg-info col-${gtd} border`;
+                        return <span className={className}>{gtd}</span>;
+                      })}
+                    </div>
+                  </a>
+                );
+              })}
             </div>
-          </a>
-        </div>
+          );
+        })}
       </div>
     </div>
   );

+ 11 - 0
src/client/js/components/PageEditor/GridEditorUtil.js

@@ -7,6 +7,17 @@ class GridEditorUtil {
     // https://regex101.com/r/7BN2fR/11
     this.lineBeginPartOfGridRE = /^:::(\s.*)editable-row$/;
     this.lineEndPartOfGridRE = /^:::$/;
+    this.mappingAllGridDivisionPatterns = [
+      [
+        [2, 10], [4, 8], [6, 6], [8, 4], [10, 2],
+      ],
+      [
+        [2, 5, 5], [5, 2, 5], [5, 5, 2], [4, 4, 4], [3, 3, 6], [3, 6, 3], [6, 3, 3],
+      ],
+      [
+        [2, 2, 4, 4], [4, 4, 2, 2], [2, 4, 2, 4], [4, 2, 4, 2], [3, 3, 3, 3], [2, 2, 2, 6], [6, 2, 2, 2],
+      ],
+    ];
     this.isInGridBlock = this.isInGridBlock.bind(this);
     this.replaceGridWithHtmlWithEditor = this.replaceGridWithHtmlWithEditor.bind(this);
   }

+ 3 - 2
src/client/styles/scss/_on-edit.scss

@@ -313,8 +313,9 @@ body.on-edit {
  Grid Edit Modal
 */
 
-.grw-grid-edit-modal{
+.grw-grid-edit-modal {
   .grid-division-menu {
-    width: 600px;
+    //[TODO: responsive by gw-3244]
+    width: 1000px;
   }
 }