Update grid layout to support placeholders, as well as grid screens
This commit is contained in:
parent
6f8e669107
commit
8860acad73
|
@ -240,6 +240,7 @@
|
||||||
},
|
},
|
||||||
empty: emptyState,
|
empty: emptyState,
|
||||||
selected,
|
selected,
|
||||||
|
isRoot,
|
||||||
inSelectedPath,
|
inSelectedPath,
|
||||||
name,
|
name,
|
||||||
editing,
|
editing,
|
||||||
|
|
|
@ -18,9 +18,11 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
color: var(--spectrum-global-color-gray-600);
|
color: var(--spectrum-global-color-gray-600);
|
||||||
font-size: var(--font-size-s);
|
font-size: var(--font-size-s);
|
||||||
gap: var(--spacing-s);
|
gap: var(--spacing-s);
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
grid-row: 1 / -1;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: var(--spacing-s);
|
gap: var(--spacing-s);
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
grid-row: 1 / -1;
|
||||||
}
|
}
|
||||||
.placeholder :global(.spectrum-Button) {
|
.placeholder :global(.spectrum-Button) {
|
||||||
margin-top: var(--spacing-m);
|
margin-top: var(--spacing-m);
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
$: availableRows = Math.floor(height / GridRowHeight)
|
$: availableRows = Math.floor(height / GridRowHeight)
|
||||||
$: rows = Math.max(requiredRows, availableRows)
|
$: rows = Math.max(requiredRows, availableRows)
|
||||||
$: mobile = $context.device.mobile
|
$: mobile = $context.device.mobile
|
||||||
$: empty = $component.empty
|
|
||||||
$: colSize = width / GridColumns
|
$: colSize = width / GridColumns
|
||||||
$: styles.set({
|
$: styles.set({
|
||||||
...$component.styles,
|
...$component.styles,
|
||||||
|
@ -40,7 +39,6 @@
|
||||||
"--col-size": colSize,
|
"--col-size": colSize,
|
||||||
"--row-size": GridRowHeight,
|
"--row-size": GridRowHeight,
|
||||||
},
|
},
|
||||||
empty: false,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Calculates the minimum number of rows required to render all child
|
// Calculates the minimum number of rows required to render all child
|
||||||
|
@ -145,11 +143,7 @@
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
<slot />
|
||||||
<!-- Only render the slot if not empty, as we don't want the placeholder -->
|
|
||||||
{#if !empty && mounted}
|
|
||||||
<slot />
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
Loading…
Reference in New Issue