Update grid layout to support placeholders, as well as grid screens

This commit is contained in:
Andrew Kingston 2024-09-05 15:15:28 +01:00
parent 6f8e669107
commit 8860acad73
No known key found for this signature in database
4 changed files with 7 additions and 8 deletions

View File

@ -240,6 +240,7 @@
},
empty: emptyState,
selected,
isRoot,
inSelectedPath,
name,
editing,

View File

@ -18,9 +18,11 @@
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
align-items: flex-start;
color: var(--spectrum-global-color-gray-600);
font-size: var(--font-size-s);
gap: var(--spacing-s);
grid-column: 1 / -1;
grid-row: 1 / -1;
}
</style>

View File

@ -23,6 +23,8 @@
align-items: center;
gap: var(--spacing-s);
flex: 1 1 auto;
grid-column: 1 / -1;
grid-row: 1 / -1;
}
.placeholder :global(.spectrum-Button) {
margin-top: var(--spacing-m);

View File

@ -27,7 +27,6 @@
$: availableRows = Math.floor(height / GridRowHeight)
$: rows = Math.max(requiredRows, availableRows)
$: mobile = $context.device.mobile
$: empty = $component.empty
$: colSize = width / GridColumns
$: styles.set({
...$component.styles,
@ -40,7 +39,6 @@
"--col-size": colSize,
"--row-size": GridRowHeight,
},
empty: false,
})
// Calculates the minimum number of rows required to render all child
@ -145,11 +143,7 @@
{/each}
</div>
{/if}
<!-- Only render the slot if not empty, as we don't want the placeholder -->
{#if !empty && mounted}
<slot />
{/if}
<slot />
</div>
<style>