Skip to content

Commit f7e3c17

Browse files
authored
Added support for grid editor layout (#62)
1 parent b580d14 commit f7e3c17

File tree

15 files changed

+109
-0
lines changed

15 files changed

+109
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@model string
2+
<h1>@Model</h1>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@using Newtonsoft.Json.Linq;
2+
@using Newtonsoft.Json;
3+
@using Umbraco.Headless.Client.Net.Delivery.Models;
4+
@model JObject
5+
@{
6+
string url = Model.Property("url").Value.ToString();
7+
string altText = Model.Property("altText").Value.ToString();
8+
}
9+
10+
<img src="@url" alt="@altText">
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@model string
2+
<blockquote>@Model</blockquote>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@model string
2+
@Html.Raw(Model)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@model Umbraco.Headless.Client.Net.Delivery.Models.GridArea
2+
<div class="grid-area" style="--span-columns: @(Model.Grid)">
3+
@foreach (var control in Model.Controls)
4+
{
5+
<partial name="Content/[email protected]" model="@(control.Value)" />
6+
}
7+
</div>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@model Umbraco.Headless.Client.Net.Delivery.Models.Grid
2+
<div class="grid">
3+
@foreach (var section in Model.Sections) {
4+
<partial name="Grid/_Section" model="@(section)" />
5+
}
6+
</div>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@model Umbraco.Headless.Client.Net.Delivery.Models.GridRow
2+
<div class="grid-row">
3+
@foreach (var area in Model.Areas)
4+
{
5+
<partial name="Grid/_Area" model="@(area)" />
6+
}
7+
</div>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@model Umbraco.Headless.Client.Net.Delivery.Models.GridSection
2+
<div style="--span-columns: @(Model.Grid)" class="grid-section">
3+
@foreach (var row in Model.Rows) {
4+
<partial name="Grid/_Row" model="@(row)" />
5+
}
6+
</div>

samples/Umbraco.Headless.Client.Samples.Web/Umbraco.Headless.Client.Samples.Web/wwwroot/css/site.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,17 @@ a:hover {
269269
grid-column: 1;
270270
}
271271

272+
/* Grid */
273+
.grid, .grid-row {
274+
display: grid;
275+
grid-template-columns: repeat(12,minmax(0,1fr));
276+
column-gap: 20px;
277+
}
278+
279+
.grid-section, .grid-area {
280+
grid-column-end: span var(--span-columns);
281+
}
282+
272283
@media (min-width: 992px) {
273284
.text-and-image {
274285
margin: 40px;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System.Collections.Generic;
2+
3+
namespace Umbraco.Headless.Client.Net.Delivery.Models
4+
{
5+
public class Grid
6+
{
7+
public IEnumerable<GridSection> Sections { get; set; }
8+
}
9+
}

0 commit comments

Comments
 (0)