Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #370 from B77Mills/fixIdxPropSpread
Browse files Browse the repository at this point in the history
Set default value & spread props only when set
  • Loading branch information
solocommand authored Jul 9, 2022
2 parents 30eb984 + b6261df commit 79b9770
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +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 newsletterBlockProps = getAsObject(input, "newsletterBlockProps");
$ const newsletterConfig = site.getAsObject(`newsletter.${newsletterSignupConfigName}`);
$ const blockName = input.blockName || "site-footer";
$ const tagline = site.get("tagline");
Expand Down Expand Up @@ -36,7 +38,7 @@ $ const useIdxNewsletterSignup = defaultValue(input.useIdxNewsletterSignup, true
<div class="row">
<marko-web-element block-name=blockName name="section" attrs={ "aria-label": "Newsletter Sign-Up Form Footer"}>
<if(!newsletterConfig.disabled && useIdxNewsletterSignup)>
<identity-x-newsletter-form-footer config-name=newsletterSignupConfigName ...input.newsletterBlockProps />
<identity-x-newsletter-form-footer config-name=newsletterSignupConfigName ...newsletterBlockProps />
</if>
<else-if(!newsletterConfig.disabled && newsletterConfig.action)>
<theme-newsletter-signup-banner-external-block
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +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 newsletterMenuBlockProps = getAsObject(input, "newsletterMenuBlockProps");
$ const blockName = input.blockName || "site-header";
$ const useIdxNewsletterSignup = defaultValue(input.useIdxNewsletterSignup, true);
$ const showSearchIcon = defaultValue(input.showSearchIcon, false);
Expand Down Expand Up @@ -88,8 +90,8 @@ $ const navigation = {
</marko-web-block>

<if(useIdxNewsletterSignup)>
<identity-x-newsletter-form-pushdown ...input.newsletterMenuBlockProps />
<identity-x-newsletter-form-pushdown ...newsletterMenuBlockProps />
</if>
<else>
<theme-site-newsletter-menu ...input.newsletterMenuBlockProps />
<theme-site-newsletter-menu ...newsletterMenuBlockProps />
</else>

0 comments on commit 79b9770

Please sign in to comment.