@canopy-iiif/app 1.5.15 → 1.5.17

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.
@@ -2466,7 +2466,7 @@ function getSharedRoot() {
2466
2466
  function getSafePageContext() {
2467
2467
  const root = getSharedRoot();
2468
2468
  if (root && root[CONTEXT_KEY]) return root[CONTEXT_KEY];
2469
- const ctx = React20.createContext({ navigation: null, page: null });
2469
+ const ctx = React20.createContext({ navigation: null, page: null, site: null });
2470
2470
  if (root) root[CONTEXT_KEY] = ctx;
2471
2471
  return ctx;
2472
2472
  }
@@ -2533,13 +2533,18 @@ function CanopyHeader(props = {}) {
2533
2533
  searchHotkey = "mod+k",
2534
2534
  searchPlaceholder = "Search\u2026",
2535
2535
  brandHref = "/",
2536
- title = "Canopy IIIF",
2536
+ title: titleProp,
2537
2537
  logo: SiteLogo
2538
2538
  } = props;
2539
2539
  const navLinks = ensureArray(navLinksProp);
2540
2540
  const PageContext = getSafePageContext();
2541
2541
  const context = React20.useContext(PageContext);
2542
2542
  const contextNavigation = context && context.navigation ? context.navigation : null;
2543
+ const contextSite = context && context.site ? context.site : null;
2544
+ const contextSiteTitle = contextSite && typeof contextSite.title === "string" ? contextSite.title.trim() : "";
2545
+ const defaultHeaderTitle = contextSiteTitle || "Site title";
2546
+ const normalizedTitleProp = typeof titleProp === "string" ? titleProp.trim() : "";
2547
+ const resolvedTitle = normalizedTitleProp || defaultHeaderTitle;
2543
2548
  const sectionNavigation = contextNavigation && contextNavigation.root ? contextNavigation : null;
2544
2549
  const navigationRoots = contextNavigation && contextNavigation.allRoots ? contextNavigation.allRoots : null;
2545
2550
  const sectionHeading = sectionNavigation && sectionNavigation.title || (sectionNavigation && sectionNavigation.root ? sectionNavigation.root.title : "");
@@ -2568,7 +2573,7 @@ function CanopyHeader(props = {}) {
2568
2573
  /* @__PURE__ */ React20.createElement("div", { className: "canopy-header__brand" }, /* @__PURE__ */ React20.createElement(
2569
2574
  CanopyBrand,
2570
2575
  {
2571
- label: title,
2576
+ label: resolvedTitle,
2572
2577
  href: brandHref,
2573
2578
  className: "canopy-header__brand-link",
2574
2579
  Logo: SiteLogo
@@ -2663,7 +2668,7 @@ function CanopyHeader(props = {}) {
2663
2668
  id: "canopy-modal-nav",
2664
2669
  variant: "nav",
2665
2670
  labelledBy: "canopy-modal-nav-label",
2666
- label: title,
2671
+ label: resolvedTitle,
2667
2672
  logo: SiteLogo,
2668
2673
  href: brandHref,
2669
2674
  closeLabel: "Close navigation",
@@ -2758,7 +2763,7 @@ function CanopyHeader(props = {}) {
2758
2763
  id: "canopy-modal-search",
2759
2764
  variant: "search",
2760
2765
  labelledBy: "canopy-modal-search-label",
2761
- label: title,
2766
+ label: resolvedTitle,
2762
2767
  logo: SiteLogo,
2763
2768
  href: brandHref,
2764
2769
  closeLabel: "Close search",