@sprintup-cms/sdk 1.8.62 → 1.8.63

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.
@@ -1258,23 +1258,24 @@ function CMSFooter({ footer }) {
1258
1258
  const sd = getSD(footer);
1259
1259
  if (!sd) return null;
1260
1260
  const sections = Array.isArray(sd.sections) ? sd.sections : [];
1261
+ const isLegacy = sections.length === 0 && ("brand" in sd || "columns" in sd || "contact" in sd || "social" in sd || "legal" in sd);
1261
1262
  let renderSections = sections;
1262
- if (renderSections.length === 0 && (sd.brand || sd.columns || sd.contact || sd.social || sd.legal)) {
1263
+ if (isLegacy) {
1263
1264
  renderSections = [];
1264
1265
  if (sd.brand?.logo_url || sd.brand?.tagline) renderSections.push({ id: "b", type: "brand", ...sd.brand });
1265
- (sd.columns || []).forEach((col) => renderSections.push({ id: col.id || col.title, type: "links", title: col.title, links: col.links }));
1266
- if (sd.contact?.email || sd.contact?.phone) renderSections.push({ id: "c", type: "contact", ...sd.contact });
1267
- if (Object.values(sd.social || {}).some(Boolean)) renderSections.push({ id: "s", type: "social", ...sd.social });
1266
+ (Array.isArray(sd.columns) ? sd.columns : []).forEach((col) => renderSections.push({ id: col.id || col.title || Math.random(), type: "links", title: col.title, links: col.links || [] }));
1267
+ if (sd.contact?.email || sd.contact?.phone || sd.contact?.address) renderSections.push({ id: "c", type: "contact", ...sd.contact });
1268
+ if (sd.social && Object.values(sd.social).some(Boolean)) renderSections.push({ id: "s", type: "social", ...sd.social });
1268
1269
  }
1269
- const legalSec = sd.sections ? sd.sections.find((s) => s.type === "legal") : sd.legal;
1270
+ const legalSec = sections.find((s) => s.type === "legal") ?? (isLegacy ? sd.legal ?? null : null);
1270
1271
  const mainSections = renderSections.filter((s) => s.type !== "legal");
1271
- if (mainSections.length === 0 && !legalSec) return null;
1272
+ const copyright = legalSec?.copyright || "";
1273
+ const legalLinks = Array.isArray(legalSec?.legal_links) ? legalSec.legal_links : Array.isArray(legalSec?.links) ? legalSec.links : [];
1274
+ const hasBottom = !!(copyright || legalLinks.filter((l) => l.label).length);
1275
+ if (mainSections.length === 0 && !hasBottom) return null;
1272
1276
  const gridCount = mainSections.length;
1273
1277
  const gridCols = gridCount <= 1 ? "1fr" : gridCount === 2 ? "repeat(2,1fr)" : gridCount === 3 ? "repeat(3,1fr)" : "repeat(4,1fr)";
1274
1278
  const mutedLink = { fontSize: "0.875rem", color: "var(--muted-foreground, #6b7280)", textDecoration: "none" };
1275
- const copyright = legalSec?.copyright || "";
1276
- const legalLinks = legalSec?.legal_links || legalSec?.links || [];
1277
- const hasBottom = copyright || legalLinks.filter((l) => l.label).length > 0;
1278
1279
  return /* @__PURE__ */ jsx("footer", { style: { borderTop: "1px solid var(--border, #e5e7eb)", background: "var(--muted, #f9fafb)", marginTop: "4rem" }, children: /* @__PURE__ */ jsxs("div", { style: { maxWidth: "1200px", margin: "0 auto", padding: "3rem 1.5rem 1.5rem" }, children: [
1279
1280
  mainSections.length > 0 && /* @__PURE__ */ jsx("div", { style: { display: "grid", gridTemplateColumns: gridCols, gap: "2.5rem", marginBottom: hasBottom ? "2.5rem" : 0 }, children: mainSections.map((sec) => {
1280
1281
  const rendered = renderFooterSection(sec, mutedLink);