fix: card contaner, disable card instead of removing it

This commit is contained in:
Arman
2025-04-14 11:45:16 +02:00
parent c64f3d5e71
commit df5bf3b789
7 changed files with 10 additions and 9 deletions
+3 -3
View File
@@ -7,7 +7,7 @@
import { isCloud } from '$lib/system';
import CardPlanLimit from './cardPlanLimit.svelte';
export let showEmpty = true;
export let disableEmpty = true;
export let offset = 0;
export let total = 0;
export let event: string = null;
@@ -25,8 +25,8 @@
{#if total > 3 ? total < limit + offset : total % 2 !== 0}
{#if isCloud && serviceId && total >= planLimit}
<CardPlanLimit {service} />
{:else if showEmpty}
<Empty on:click target={event}>
{:else}
<Empty on:click target={event} disabled={disableEmpty}>
<slot name="empty" />
</Empty>
{/if}
+2 -1
View File
@@ -9,6 +9,7 @@
export let href: string = null;
export let allowCreate = true;
export let description = 'Need a hand? Learn more in our documentation.';
export let disabled = false;
export let src: string = null;
function track() {
@@ -47,7 +48,7 @@
</Empty>
</Card.Base>
{:else}
<Card.Button on:click on:click={track} aria-label="create">
<Card.Button on:click on:click={track} aria-label="create" {disabled}>
<Layout.Stack justifyContent="center" alignItems="center" gap="m">
<Avatar size="s"><Icon icon={IconPlus} size="s" /></Avatar>
<Typography.Text variation="m-400" align="center"><slot /></Typography.Text>
@@ -175,7 +175,7 @@
{#if data.projects.total}
<CardContainer
showEmpty={$canWriteProjects}
disableEmpty={!$canWriteProjects}
total={data.projects.total}
offset={data.offset}
on:click={handleCreateProject}>
@@ -12,7 +12,7 @@
</script>
<CardContainer
showEmpty={$canWriteCollections}
disableEmpty={!$canWriteCollections}
total={data.collections.total}
on:click={() => (showCreate = true)}
event="collection">
@@ -10,7 +10,7 @@
</script>
<CardContainer
showEmpty={$canWriteDatabases}
disableEmpty={!$canWriteDatabases}
total={data.databases.total}
on:click={() => (showCreate = true)}
event="database"
@@ -88,7 +88,7 @@
{#if data.functions.total}
<CardContainer
{offset}
showEmpty={$canWriteFunctions}
disableEmpty={!$canWriteFunctions}
event="functions"
total={data.functions.total}
service="functions"
@@ -13,7 +13,7 @@
</script>
<CardContainer
showEmpty={$canWriteBuckets}
disableEmpty={!$canWriteBuckets}
total={data.buckets.total}
offset={data.offset}
event="bucket"