From 381f7d17eec2c0cfa5fd344b656354e7f8a4d795 Mon Sep 17 00:00:00 2001 From: Brian Miller Date: Fri, 8 Jul 2022 17:30:10 -0500 Subject: [PATCH 1/4] Set default value & spread props only when set --- .../marko-web-theme-monorail/components/site-footer.marko | 3 ++- .../marko-web-theme-monorail/components/site-header.marko | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/marko-web-theme-monorail/components/site-footer.marko b/packages/marko-web-theme-monorail/components/site-footer.marko index d90841fb7..0df6eb9c4 100644 --- a/packages/marko-web-theme-monorail/components/site-footer.marko +++ b/packages/marko-web-theme-monorail/components/site-footer.marko @@ -4,6 +4,7 @@ import { asObject } from "@parameter1/base-cms-utils"; $ const { config, site, i18n } = out.global; $ const newsletterSignupConfigName = defaultValue(input.newsletterSignupConfigName, "signupFooter"); +$ const newsletterProps = defaultValue(input.newsletterBlockProps, {}); $ const newsletterConfig = site.getAsObject(`newsletter.${newsletterSignupConfigName}`); $ const blockName = input.blockName || "site-footer"; $ const tagline = site.get("tagline"); @@ -36,7 +37,7 @@ $ const useIdxNewsletterSignup = defaultValue(input.useIdxNewsletterSignup, true
- + - + - + From af99395e1fa8a03409f281a60df76cfd514820ec Mon Sep 17 00:00:00 2001 From: Brandon Krigbaum Date: Sat, 9 Jul 2022 06:24:17 -0500 Subject: [PATCH 2/4] Use getAsObject --- packages/marko-web-theme-monorail/components/site-footer.marko | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/marko-web-theme-monorail/components/site-footer.marko b/packages/marko-web-theme-monorail/components/site-footer.marko index 0df6eb9c4..a7c6cb8c7 100644 --- a/packages/marko-web-theme-monorail/components/site-footer.marko +++ b/packages/marko-web-theme-monorail/components/site-footer.marko @@ -1,10 +1,11 @@ import getNavItems from "@parameter1/base-cms-marko-web-theme-default/components/site-navbar/utils/get-nav-items"; import defaultValue from "@parameter1/base-cms-marko-core/utils/default-value"; +import { getAsObject } from "@parameter1/base-cms-object-path"; import { asObject } from "@parameter1/base-cms-utils"; $ const { config, site, i18n } = out.global; $ const newsletterSignupConfigName = defaultValue(input.newsletterSignupConfigName, "signupFooter"); -$ const newsletterProps = defaultValue(input.newsletterBlockProps, {}); +$ const newsletterProps = getAsObject(input, "newsletterBlockProps"); $ const newsletterConfig = site.getAsObject(`newsletter.${newsletterSignupConfigName}`); $ const blockName = input.blockName || "site-footer"; $ const tagline = site.get("tagline"); From cd2202b4f2ab0a6e41fae54eb8004f441f71cb47 Mon Sep 17 00:00:00 2001 From: Brandon Krigbaum Date: Sat, 9 Jul 2022 06:26:47 -0500 Subject: [PATCH 3/4] Rename variable to match --- packages/marko-web-theme-monorail/components/site-footer.marko | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/marko-web-theme-monorail/components/site-footer.marko b/packages/marko-web-theme-monorail/components/site-footer.marko index a7c6cb8c7..e432f9873 100644 --- a/packages/marko-web-theme-monorail/components/site-footer.marko +++ b/packages/marko-web-theme-monorail/components/site-footer.marko @@ -5,7 +5,7 @@ import { asObject } from "@parameter1/base-cms-utils"; $ const { config, site, i18n } = out.global; $ const newsletterSignupConfigName = defaultValue(input.newsletterSignupConfigName, "signupFooter"); -$ const newsletterProps = getAsObject(input, "newsletterBlockProps"); +$ const newsletterBlockProps = getAsObject(input, "newsletterBlockProps"); $ const newsletterConfig = site.getAsObject(`newsletter.${newsletterSignupConfigName}`); $ const blockName = input.blockName || "site-footer"; $ const tagline = site.get("tagline"); From b6261df3afe932962568e2b7ce0b041a8d3914f8 Mon Sep 17 00:00:00 2001 From: Brandon Krigbaum Date: Sat, 9 Jul 2022 06:28:56 -0500 Subject: [PATCH 4/4] Use getAsObject --- .../marko-web-theme-monorail/components/site-header.marko | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/marko-web-theme-monorail/components/site-header.marko b/packages/marko-web-theme-monorail/components/site-header.marko index a578abf03..6c1906b3e 100644 --- a/packages/marko-web-theme-monorail/components/site-header.marko +++ b/packages/marko-web-theme-monorail/components/site-header.marko @@ -1,9 +1,10 @@ import defaultValue from "@parameter1/base-cms-marko-core/utils/default-value"; +import { getAsObject } from "@parameter1/base-cms-object-path"; $ const { config, site } = out.global; $ const newsletterConfig = site.getAsObject('newsletter.pushdown'); -$ const newsletterProps = defaultValue(input.newsletterMenuBlockProps, {}); +$ const newsletterMenuBlockProps = getAsObject(input, "newsletterMenuBlockProps"); $ const blockName = input.blockName || "site-header"; $ const useIdxNewsletterSignup = defaultValue(input.useIdxNewsletterSignup, true); $ const showSearchIcon = defaultValue(input.showSearchIcon, false); @@ -89,8 +90,8 @@ $ const navigation = { - + - +