Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.

Commit 5002f9a

Browse files
committed
image gallery block
1 parent e170d52 commit 5002f9a

File tree

12 files changed

+660
-4
lines changed

12 files changed

+660
-4
lines changed

blocks/fragment/fragment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function loadFragment(path) {
2222
if (path && path.startsWith('/')) {
2323
// eslint-disable-next-line no-param-reassign
2424
path = path.replace(/(\.plain)?\.html/, '');
25-
const resp = await fetch(`${path}.plain.html`);
25+
const resp = await fetch(`${window.hlx.codeBasePath}${path}.plain.html`);
2626
if (resp.ok) {
2727
const main = document.createElement('main');
2828
main.innerHTML = await resp.text();
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"definitions": [
3+
{
4+
"title": "Gallery Image",
5+
"id": "gallery-image",
6+
"plugins": {
7+
"xwalk": {
8+
"page": {
9+
"resourceType": "core/franklin/components/block/v1/block/item",
10+
"template": {
11+
"name": "Gallery Image",
12+
"model": "gallery-image",
13+
"image": "/content/dam/test/content-at-scale.png"
14+
}
15+
}
16+
}
17+
}
18+
}
19+
],
20+
"models": [
21+
{
22+
"id": "gallery-image",
23+
"fields": [
24+
{
25+
"component": "reference",
26+
"valueType": "string",
27+
"name": "image",
28+
"label": "Image"
29+
},
30+
{
31+
"component": "text",
32+
"valueType": "string",
33+
"name": "alt",
34+
"label": "Alt Text"
35+
},
36+
{
37+
"component": "text",
38+
"valueType": "string",
39+
"name": "caption",
40+
"label": "Caption"
41+
}
42+
]
43+
}
44+
],
45+
"filters": []
46+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"definitions": [
3+
{
4+
"title": "Image Gallery",
5+
"id": "image-gallery",
6+
"plugins": {
7+
"xwalk": {
8+
"page": {
9+
"resourceType": "core/franklin/components/block/v1/block",
10+
"template": {
11+
"name": "Image Gallery",
12+
"model": "image-gallery",
13+
"filter": "image-gallery"
14+
}
15+
}
16+
}
17+
}
18+
}
19+
],
20+
"models": [
21+
{
22+
"id": "image-gallery",
23+
"fields": [
24+
{
25+
"component": "select",
26+
"name": "layout",
27+
"label": "Layout",
28+
"options": [
29+
{
30+
"name": "Grid",
31+
"value": "grid"
32+
},
33+
{
34+
"name": "Masonry",
35+
"value": "masonry"
36+
},
37+
{
38+
"name": "Carousel",
39+
"value": "carousel"
40+
}
41+
]
42+
},
43+
{
44+
"component": "number",
45+
"valueType": "number",
46+
"name": "columns",
47+
"label": "Columns",
48+
"min": 1,
49+
"max": 6
50+
}
51+
]
52+
}
53+
],
54+
"filters": [
55+
{
56+
"id": "image-gallery",
57+
"components": [
58+
"gallery-image"
59+
]
60+
}
61+
]
62+
}

0 commit comments

Comments
 (0)