From 35cbdcac72515e4b4e50d867e7d22aa2d95c3252 Mon Sep 17 00:00:00 2001 From: Max Edell Date: Fri, 13 Oct 2023 13:32:07 -0700 Subject: [PATCH 1/2] fix: cls test --- blocks/hero-search/hero-search.css | 5 +++++ blocks/hero-search/hero-search.js | 26 +++++++++++--------------- blocks/search-bar/search-bar.js | 9 +++++++-- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/blocks/hero-search/hero-search.css b/blocks/hero-search/hero-search.css index edc1433..1c00c3c 100644 --- a/blocks/hero-search/hero-search.css +++ b/blocks/hero-search/hero-search.css @@ -6,6 +6,10 @@ padding: var(--spacing--20) var(--padding--mobile) 0 var(--padding--mobile); } +search-bar { + margin-top: var(--spacing--7); +} + .hero-search-wrapper { position: relative; } @@ -91,3 +95,4 @@ margin: var(--spacing--8) 0; } } +} \ No newline at end of file diff --git a/blocks/hero-search/hero-search.js b/blocks/hero-search/hero-search.js index d7563ad..dc13c0b 100644 --- a/blocks/hero-search/hero-search.js +++ b/blocks/hero-search/hero-search.js @@ -1,23 +1,18 @@ -import { loadCSS } from '../../scripts/lib-franklin.js'; +import { + loadBlock, buildBlock, decorateBlock, +} from '../../scripts/lib-franklin.js'; import { html, renderParallax } from '../../scripts/scripts.js'; -import '../search-bar/search-bar.js'; /** * @param {HTMLDivElement} block */ -export default function decorate(block) { - loadCSS(`${window.hlx.codeBasePath}/blocks/search-bar/search-bar.css`); - block.append(html` -
-
- - -
-
- `); +export default async function decorate(block) { + const searchbar = buildBlock('search-bar', [ + ['default-option', '@td_docsetid==(\'50f6a03f40793d69545a4286255f64d3\')'], + ['default-options', '[{"label": "Enterprise Edition", "category": "@td_docsetid", "value": "50f6a03f40793d69545a4286255f64d3"}, {"label": "Compute Edition", "category": "@td_docsetid", "value": "662a784654b1f7313d35c5af7501870c"}]'], + ]); + block.append(searchbar); + decorateBlock(searchbar); const ICON = `
`); wrapper.prepend(html`${ICON}`); + await loadBlock(searchbar); renderParallax(); } diff --git a/blocks/search-bar/search-bar.js b/blocks/search-bar/search-bar.js index e6f6b32..c6a9c6c 100644 --- a/blocks/search-bar/search-bar.js +++ b/blocks/search-bar/search-bar.js @@ -1,5 +1,5 @@ /* global Coveo */ -import { getMetadata, loadCSS } from '../../scripts/lib-franklin.js'; +import { getMetadata, loadCSS, readBlockConfig } from '../../scripts/lib-franklin.js'; const TAG_NAME = 'search-bar'; const COVEO_BUNDLE_VERSION = 'v2.10082'; @@ -296,7 +296,12 @@ export class SearchBar extends HTMLElement { } export default function decorate(block) { - block.innerHTML = ''; + console.log('decorate search-bar: ', block); + const config = readBlockConfig(block); + console.log('config: ', config); + block.innerHTML = ``; } (async () => { From ba645f7e79fc9c11587d611a1411b602579472ae Mon Sep 17 00:00:00 2001 From: Max Edell Date: Fri, 13 Oct 2023 13:36:11 -0700 Subject: [PATCH 2/2] fix: css typo --- blocks/hero-search/hero-search.css | 1 - 1 file changed, 1 deletion(-) diff --git a/blocks/hero-search/hero-search.css b/blocks/hero-search/hero-search.css index 1c00c3c..2c33132 100644 --- a/blocks/hero-search/hero-search.css +++ b/blocks/hero-search/hero-search.css @@ -95,4 +95,3 @@ search-bar { margin: var(--spacing--8) 0; } } -} \ No newline at end of file