diff --git a/packages/standard-components/src/Layout.svelte b/packages/standard-components/src/Layout.svelte index c896b7f2b4..35edd28fc1 100644 --- a/packages/standard-components/src/Layout.svelte +++ b/packages/standard-components/src/Layout.svelte @@ -12,12 +12,24 @@ twoColumns: 2, threeColumns: 3, } + + let containerWidth + $: columnsDependingOnSize = calculateColumns(containerWidth) + + function calculateColumns(parentWidth) { + const numberOfAllowedColumns = Math.floor(parentWidth / 250) || 100 + if (layoutMap[type] <= numberOfAllowedColumns) { + return false + } else if (layoutMap[type] > numberOfAllowedColumns) { + return numberOfAllowedColumns + } + }
{#if layoutMap[type] - $component.children > 0} @@ -44,6 +56,15 @@ .threeColumns { grid-template-columns: 1fr 1fr 1fr; } + .containerSmall { + grid-template-columns: 1fr; + } + .columns-1 { + grid-template-columns: 1fr; + } + .columns-2 { + grid-template-columns: 1fr 1fr; + } p { background-color: var(--grey-3);