From 1b8e5fed12d32c5628146b698579fc188dd67659 Mon Sep 17 00:00:00 2001 From: robin <binkrassdufass@gmail.com> Date: Fri, 8 Sep 2023 14:00:13 +0000 Subject: [PATCH] fix --- .../components/Pagebuilder/Pagebuilder.svelte | 97 ++++++++++--------- .../lib/components/Pagebuilder/Rows.svelte | 8 +- 2 files changed, 54 insertions(+), 51 deletions(-) diff --git a/frontend/src/lib/components/Pagebuilder/Pagebuilder.svelte b/frontend/src/lib/components/Pagebuilder/Pagebuilder.svelte index b8ceb3e..a5cf722 100644 --- a/frontend/src/lib/components/Pagebuilder/Pagebuilder.svelte +++ b/frontend/src/lib/components/Pagebuilder/Pagebuilder.svelte @@ -64,54 +64,55 @@ {#if row.subTitle} <h3 class="subheading">{row.subTitle}</h3> {/if} - <div - class="row" - class:twoToThree="{row.twoToThree}" - class:normalWrap="{row.flexWrapNormal}" - class:dominant="{row.columns.some((col) => col.contentType == 'iconCycleCircle')}" - > - {#each row?.columns as col} - <div class="col" class:dominant="{col.contentType == 'iconCycleCircle'}"> - {#if col?.contentType == "text"} - <Text text="{col?.text}" /> - {:else if col?.contentType == "textLink"} - <TextLink - description="{col?.textLink?.text}" - path="{Object.values($pages)?.find((o) => o.id == col.textLink.link)?.path || '/'}" - bright="{bright}" - /> - {:else if col.contentType == "image"} - <Image image="{col?.image}" col="{col}" pageId="{pageId}" /> - {:else if col.contentType == "iconBlocks"} - <IconBlock pageId="{pageId}" col="{col}" /> - {:else if col.contentType == "pageLinkBlocks"} - <PageLinkBlocks col="{col}" /> - {:else if col.contentType == "networkEvents"} - <Events col="{col}" pageId="{pageId}" /> - {:else if col.contentType == "publications"} - <Publications col="{col}" pageId="{pageId}" /> - {:else if col.contentType == "topDown"} - <TopDown col="{col}" /> - {:else if col.contentType == "infoBoard"} - <InfoBoard col="{col}" pageId="{pageId}" /> - {:else if col.contentType == "nestedCard"} - <NestedCard col="{col}" /> - {:else if col.contentType == "boxlist"} - <Boxlist col="{col}" /> - {:else if col.contentType == "extendableBoxes"} - <ExtendableBox col="{col}" /> - {:else if col.contentType == "personPreview"} - <Persons col="{col}" pageId="{pageId}" /> - {:else if col.contentType == "iconCycleCircle"} - <IconCycleCircle col="{col}" pageId="{pageId}" /> - {:else if col.contentType == "iconCycleSquare"} - <IconCycleBox col="{col}" pageId="{pageId}" /> - {:else if col.contentType == "worldCard"} - <WorldCard col="{col}" pageId="{pageId}" /> - {/if} - </div> - {/each} - </div> + {#if row?.columns?.length} + <div + class="row" + class:twoToThree="{row.twoToThree}" + class:normalWrap="{row.flexWrapNormal}" + class:dominant="{row.columns.some((col) => col.contentType == 'iconCycleCircle')}" + > + {#each row?.columns as col} + <div class="col" class:dominant="{col.contentType == 'iconCycleCircle'}"> + {#if col?.contentType == "text"} + <Text text="{col?.text}" /> + {:else if col?.contentType == "textLink"} + <TextLink + description="{col?.textLink?.text}" + path="{Object.values($pages)?.find((o) => o.id == col.textLink.link)?.path || '/'}" + bright="{bright}" + /> + {:else if col.contentType == "image"} + <Image image="{col?.image}" col="{col}" pageId="{pageId}" /> + {:else if col.contentType == "iconBlocks"} + <IconBlock pageId="{pageId}" col="{col}" /> + {:else if col.contentType == "pageLinkBlocks"} + <PageLinkBlocks col="{col}" /> + {:else if col.contentType == "networkEvents"} + <Events col="{col}" pageId="{pageId}" /> + {:else if col.contentType == "publications"} + <Publications col="{col}" pageId="{pageId}" /> + {:else if col.contentType == "topDown"} + <TopDown col="{col}" /> + {:else if col.contentType == "infoBoard"} + <InfoBoard col="{col}" pageId="{pageId}" /> + {:else if col.contentType == "nestedCard"} + <NestedCard col="{col}" /> + {:else if col.contentType == "boxlist"} + <Boxlist col="{col}" /> + {:else if col.contentType == "extendableBoxes"} + <ExtendableBox col="{col}" /> + {:else if col.contentType == "personPreview"} + <Persons col="{col}" pageId="{pageId}" /> + {:else if col.contentType == "iconCycleCircle"} + <IconCycleCircle col="{col}" pageId="{pageId}" /> + {:else if col.contentType == "iconCycleSquare"} + <IconCycleBox col="{col}" pageId="{pageId}" /> + {:else if col.contentType == "worldCard"} + <WorldCard col="{col}" pageId="{pageId}" /> + {/if} + </div> + {/each} + </div>{/if} {/if} <style lang="less"> diff --git a/frontend/src/lib/components/Pagebuilder/Rows.svelte b/frontend/src/lib/components/Pagebuilder/Rows.svelte index 85d8a21..03480cd 100644 --- a/frontend/src/lib/components/Pagebuilder/Rows.svelte +++ b/frontend/src/lib/components/Pagebuilder/Rows.svelte @@ -39,6 +39,7 @@ initPage() } } + $: console.log(page?.rows, "==rows") </script> <div class="rows" class:HP="{path == '/'}"> @@ -48,9 +49,10 @@ <div class="row" id="row-{i}" - style="{path == '/' && i == page.rows.length - 1 ? 'padding-bottom: 300px;' : ''} {row.noBottomMargin - ? 'margin-bottom: 0px;' - : ''} {row.noTopMargin ? 'margin-top: 0px;' : ''}" + style="{path == '/' && i == page.rows.length - 1 ? 'padding-bottom: 300px;' : ''} {row.row + .noBottomMargin + ? 'margin-bottom: 0px; padding-bottom: 0px;' + : ''} {row.row.noTopMargin ? 'margin-top: 0px; padding-top: 0px;' : ''}" > {#if row.row.backgroundImage} <div class="background-image">