soames-astro-theme 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -155,11 +155,14 @@ const handleShortcodes: HTMLReactParserOptions["replace"] = (node) => {
|
|
|
155
155
|
|
|
156
156
|
if (classes.includes("wp-block-soames-gallery-menu")) {
|
|
157
157
|
const attrs = (node as DomElement).attribs;
|
|
158
|
+
// ORBI-44: "compact" fits 4 per row; anything else defaults to "standard".
|
|
159
|
+
const layout = attrs["data-layout"] === "compact" ? "compact" : "standard";
|
|
158
160
|
// ORBI-20: prefer JSON `data-items`, fall back to legacy comma attrs.
|
|
159
161
|
if (attrs["data-items"]) {
|
|
160
162
|
try {
|
|
161
163
|
const items = JSON.parse(attrs["data-items"]);
|
|
162
|
-
if (Array.isArray(items))
|
|
164
|
+
if (Array.isArray(items))
|
|
165
|
+
return <SoamesGalleryMenu items={items} layout={layout} />;
|
|
163
166
|
} catch {
|
|
164
167
|
/* malformed JSON — fall through to legacy parsing below */
|
|
165
168
|
}
|
|
@@ -167,6 +170,7 @@ const handleShortcodes: HTMLReactParserOptions["replace"] = (node) => {
|
|
|
167
170
|
const csv = (key: string) => (attrs[key] ?? "").split(",");
|
|
168
171
|
return (
|
|
169
172
|
<SoamesGalleryMenu
|
|
173
|
+
layout={layout}
|
|
170
174
|
attributes={{
|
|
171
175
|
images: csv("data-images"),
|
|
172
176
|
labels: csv("data-labels"),
|
|
@@ -24,12 +24,16 @@ interface GalleryMenuItem {
|
|
|
24
24
|
css?: string | null;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
// ORBI-44: "standard" = 3 items per row, "compact" = 4 items per row.
|
|
28
|
+
type GalleryMenuLayout = "standard" | "compact";
|
|
29
|
+
|
|
27
30
|
interface SoamesGalleryMenuProps {
|
|
28
31
|
items?: GalleryMenuItemInput[];
|
|
29
32
|
attributes?: GalleryMenuAttributes;
|
|
33
|
+
layout?: GalleryMenuLayout;
|
|
30
34
|
}
|
|
31
35
|
|
|
32
|
-
const SoamesGalleryMenu: React.FC<SoamesGalleryMenuProps> = ({ items, attributes }) => {
|
|
36
|
+
const SoamesGalleryMenu: React.FC<SoamesGalleryMenuProps> = ({ items, attributes, layout = "standard" }) => {
|
|
33
37
|
const normalizeUrl = (url: string) => (url ?? "").replace(/['""]+/g, '"');
|
|
34
38
|
|
|
35
39
|
let menuItems: GalleryMenuItem[];
|
|
@@ -57,12 +61,15 @@ const SoamesGalleryMenu: React.FC<SoamesGalleryMenuProps> = ({ items, attributes
|
|
|
57
61
|
// Drop rows with no image (e.g. a trailing comma in the legacy format).
|
|
58
62
|
menuItems = menuItems.filter((item) => item.imageUrl.trim().length > 0);
|
|
59
63
|
|
|
64
|
+
// Standard fits 3 across (col-lg-4); compact fits 4 across (col-lg-3).
|
|
65
|
+
const colClass = layout === "compact" ? "col-lg-3" : "col-lg-4";
|
|
66
|
+
|
|
60
67
|
return (
|
|
61
|
-
<section className=
|
|
62
|
-
<div className="container
|
|
68
|
+
<section className={`features1 soames-gallery-menu soames-gallery-menu--${layout}`}>
|
|
69
|
+
<div className="container">
|
|
63
70
|
<div className="media-container-row">
|
|
64
71
|
{menuItems.map(menuItem => (
|
|
65
|
-
<div key={menuItem.id} className=
|
|
72
|
+
<div key={menuItem.id} className={`card p-3 col-md-12 ${colClass}`}>
|
|
66
73
|
<div className="card-wrapper">
|
|
67
74
|
<div className="card-img">
|
|
68
75
|
<a href={menuItem.link ?? "#"}>
|
|
@@ -878,6 +878,28 @@ section.lazy-placeholder:after {
|
|
|
878
878
|
background-color: #fff;
|
|
879
879
|
}
|
|
880
880
|
|
|
881
|
+
/* ORBI-44: keep every tile the same size regardless of the source image's
|
|
882
|
+
aspect ratio. Without this, images render at their natural height, so an
|
|
883
|
+
oddly-shaped photo makes its card shorter than its neighbours. A fixed 4:3
|
|
884
|
+
box + object-fit:cover normalizes them (4:3 source images are not cropped).
|
|
885
|
+
min-width:0 stops a large image from blowing its flex card past the column
|
|
886
|
+
width, so the columns share the row evenly. */
|
|
887
|
+
.soames-gallery-menu .card {
|
|
888
|
+
min-width: 0;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
.soames-gallery-menu .card-img {
|
|
892
|
+
aspect-ratio: 4 / 3;
|
|
893
|
+
overflow: hidden;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
.soames-gallery-menu .card-img img {
|
|
897
|
+
width: 100%;
|
|
898
|
+
height: 100%;
|
|
899
|
+
object-fit: cover;
|
|
900
|
+
display: block;
|
|
901
|
+
}
|
|
902
|
+
|
|
881
903
|
.soames-gallery-menu .card-box {
|
|
882
904
|
background-color: #ffffff;
|
|
883
905
|
padding: 2rem;
|
|
@@ -914,6 +936,14 @@ section.lazy-placeholder:after {
|
|
|
914
936
|
max-width: 20%;
|
|
915
937
|
padding: 15px;
|
|
916
938
|
}
|
|
939
|
+
|
|
940
|
+
/* ORBI-44: the shared .media-container-row is nowrap at >=992px, which forces
|
|
941
|
+
every gallery card onto one line. Re-enable wrapping (scoped to the gallery,
|
|
942
|
+
higher specificity so it wins) so the column classes below wrap into rows —
|
|
943
|
+
standard (col-lg-4) = 3 per row, compact (col-lg-3) = 4 per row. */
|
|
944
|
+
.soames-gallery-menu .media-container-row {
|
|
945
|
+
flex-wrap: wrap;
|
|
946
|
+
}
|
|
917
947
|
}
|
|
918
948
|
|
|
919
949
|
.media-wrap-icon {
|