soames-astro-theme 0.1.7 → 0.1.8

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "soames-astro-theme",
3
3
  "type": "module",
4
- "version": "0.1.7",
4
+ "version": "0.1.8",
5
5
  "description": "Shared Astro theme for the Soames ecosystem (WordPress headless + React islands). Successor to soames-gatsby-theme.",
6
6
  "keywords": [
7
7
  "astro",
@@ -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)) return <SoamesGalleryMenu items={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="features1 soames-gallery-menu">
68
+ <section className={`features1 soames-gallery-menu soames-gallery-menu--${layout}`}>
62
69
  <div className="container-fluid">
63
70
  <div className="media-container-row">
64
71
  {menuItems.map(menuItem => (
65
- <div key={menuItem.id} className="card p-3 col-md-12 col-lg-3">
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 ?? "#"}>
@@ -914,6 +914,14 @@ section.lazy-placeholder:after {
914
914
  max-width: 20%;
915
915
  padding: 15px;
916
916
  }
917
+
918
+ /* ORBI-44: the shared .media-container-row is nowrap at >=992px, which forces
919
+ every gallery card onto one line. Re-enable wrapping (scoped to the gallery,
920
+ higher specificity so it wins) so the column classes below wrap into rows —
921
+ standard (col-lg-4) = 3 per row, compact (col-lg-3) = 4 per row. */
922
+ .soames-gallery-menu .media-container-row {
923
+ flex-wrap: wrap;
924
+ }
917
925
  }
918
926
 
919
927
  .media-wrap-icon {