Aventyret / solarplexus

Wordpress Block that is useful when building news sites
GNU General Public License v2.0
6 stars 1 forks source link

Block layout settings #7

Closed markusfinell closed 2 years ago

markusfinell commented 3 years ago

Instead of creating multiple blocks with different itemLayout settings, we could add a layout setting in the inspector controls as default.

I just tried this using a custom control:

"customControls": [
  {
    "id": "customLayout",
    "name": "Layout",
    "choices": [
      {
        "label": "Default layout",
        "value": ""
      },
      {
        "label": "Image Left",
        "value": "image-left"
      },
      {
        "label": "Image Right",
        "value": "image-right"
      },
      {
        "label": "Image Top",
        "value": "image-top"
      },
      {
        "label": "Image Bottom",
        "value": "image-bottom"
      },
      {
        "label": "Image Background",
        "value": "image-background"
      }
    ]
  }
]

I could then use the value to set another class to the posts.

I nicer solution could be to add a layout setting, and enable adding custom layout options to select. Maybe itemLayout should be an array (itemLayouts) where we add options, which we then add to the splx-gridItemPost--layout-[layoutoption] class:

"itemLayouts": [
  {
    "name": "My Custom Layout",
    "value": "my-custom-layout"
  }
  // etc
]

Output:

class="splx-gridItemPost--layout-my-custom-layout"
perarnborg commented 2 years ago

Closed. We probably want to enable this in the toolbar instead. See #59