Skip to content

Commit

Permalink
Merge branch 'main' into communities
Browse files Browse the repository at this point in the history
  • Loading branch information
jindaliiita authored Jul 30, 2024
2 parents 7149d8f + 66543f1 commit 4b80d29
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion blocks/agent-testimonials/agent-testimonials.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function decorate(block) {
});
};

const externalID = getMetadata('externalid');
const externalID = getMetadata('id');
fetch(`https://testimonialtree.com/Widgets/jsonFeed.aspx?widgetid=45133&externalID=${externalID}`)
.then((response) => response.json())
.then((data) => {
Expand Down
31 changes: 25 additions & 6 deletions scripts/util.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { fetchPlaceholders } from './aem.js';
import {
div,
img,
domEl,
} from './dom-helpers.js';
import { fetchPlaceholders, loadCSS } from './aem.js';
import { div, img, domEl } from './dom-helpers.js';

/**
* Creates the standard Spinner Div.
Expand Down Expand Up @@ -193,6 +189,27 @@ export function phoneFormat(num) {
return phoneNum;
}

export const getDesign = (designType, defaultDesign, design1, design2, design3, design4, design5) => {
switch (designType.toLowerCase()) {
case 'design-1':
return design1;
case 'design-2':
return design2;
case 'design-3':
return design3;
case 'design-4':
return design4;
case 'design-5':
return design5;
default:
return defaultDesign;
}
};

export const loadTemplateCSS = (blockName, designType) => {
loadCSS(`${window.hlx.codeBasePath}/blocks/${blockName}/${designType.toLowerCase()}.css`);
};

export const getLoader = (className) => div({ class: `${className}-loader` },
div({ class: 'animation' },
domEl('picture', img({ src: '/styles/images/loading.png' })),
Expand All @@ -206,6 +223,8 @@ const Util = {
i18nLookup,
getEnvType,
getCookieValue,
getDesign,
loadTemplateCSS,
getLoader,
};

Expand Down

0 comments on commit 4b80d29

Please sign in to comment.