feat: implement CardContainer where needed

This commit is contained in:
Arman committed 2022-10-06 17:46:50 +02:00
1 parent c0b06a3941
commit f76480a89c
5 files changed
+28 -45

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@
style={`--grid-gap:1.5rem; --grid-item-size:${total > 3 ? '22rem' : '25rem'};`}>
<slot />
{#if total < limit + offset && (total % 2 !== 0 || total % 4 !== 0)}
{#if total < limit + offset && total % 2 !== 0 && total % 4 !== 0}
<Empty isButton on:click>
<slot name="empty" />
</Empty>
@@ -1,6 +1,6 @@
<script lang="ts">
import { base } from '$app/paths';
import { GridItem1, Empty, Pagination, AvatarGroup } from '$lib/components';
import { GridItem1, Empty, Pagination, AvatarGroup, CardContainer } from '$lib/components';
import { Button } from '$lib/elements/forms';
import { Container } from '$lib/layout';
import CreateOrganization from '../../_createOrganization.svelte';
@@ -45,11 +45,10 @@
</div>
{#if $organizationList?.teams?.length}
<ul
class="grid-box common-section u-margin-block-start-32"
style={`--grid-gap:1.5rem; --grid-item-size:${
$organizationList.total > 3 ? '22rem' : '25rem'
};`}>
<CardContainer
total={$organizationList.total}
{offset}
on:click={() => (addOrganization = true)}>
{#each $organizationList.teams as organization, index}
{@const avatarList = getMemberships(organization.$id)}
{#if index >= offset && index < $cardLimit + offset}
@@ -67,12 +66,10 @@
</GridItem1>
{/if}
{/each}
{#if $organizationList?.total < $cardLimit + offset && ($organizationList?.total % 2 !== 0 || $organizationList?.total % 4 === 0)}
<Empty isButton on:click={() => (addOrganization = true)}>
<p>Create a new organization</p>
</Empty>
{/if}
</ul>
<svelte:fragment slot="empty">
<p>Create a new organization</p>
</svelte:fragment>
</CardContainer>
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {$organizationList?.total}</p>
@@ -2,7 +2,7 @@
import { page } from '$app/stores';
import { goto } from '$app/navigation';
import { Button } from '$lib/elements/forms';
import { Empty, Pagination, Copy, GridItem1 } from '$lib/components';
import { Empty, Pagination, Copy, GridItem1, CardContainer } from '$lib/components';
import { Pill } from '$lib/elements';
import { Query, type Models } from '@aw-labs/appwrite-console';
import Create from './_create.svelte';
@@ -34,9 +34,7 @@
</div>
{#if $databaseList?.total}
<div
class="grid-box common-section"
style={` --grid-item-size:${$databaseList.total > 3 ? '22rem' : '25rem'};`}>
<CardContainer total={$databaseList.total} {offset} on:click={() => (showCreate = true)}>
{#each $databaseList.databases as database}
<GridItem1
href={`${base}/console/project-${project}/databases/database/${database.$id}`}>
@@ -48,12 +46,10 @@
</Copy>
</GridItem1>
{/each}
{#if ($databaseList.total % 2 !== 0 || $databaseList.total % 4 === 0) && $databaseList.total - offset <= $cardLimit}
<Empty isButton on:click={() => (showCreate = true)}>
<p>Create a new database</p>
</Empty>
{/if}
</div>
<svelte:fragment slot="empty">
<p>Create a new database</p>
</svelte:fragment>
</CardContainer>
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {$databaseList.total}</p>
@@ -2,7 +2,7 @@
import { page } from '$app/stores';
import { goto } from '$app/navigation';
import { Button } from '$lib/elements/forms';
import { Empty, Pagination, Copy, GridItem1 } from '$lib/components';
import { Empty, Pagination, Copy, GridItem1, CardContainer } from '$lib/components';
import { Pill } from '$lib/elements';
import { Query, type Models } from '@aw-labs/appwrite-console';
import Create from './_create.svelte';
@@ -39,9 +39,7 @@
</div>
{#if $collections?.total}
<div
class="grid-box common-section"
style={` --grid-item-size:${$collections.total > 3 ? '22rem' : '25rem'};`}>
<CardContainer total={$collections.total} {offset} on:click={() => (showCreate = true)}>
{#each $collections.collections as collection}
<GridItem1
href={`${base}/console/project-${project}/databases/database/${databaseId}/collection/${collection.$id}`}>
@@ -62,12 +60,10 @@
</Copy>
</GridItem1>
{/each}
{#if ($collections.total % 2 !== 0 || $collections.total % 4 === 0) && $collections.total - offset <= $cardLimit}
<Empty isButton on:click={() => (showCreate = true)}>
<p>Create a new collection</p>
</Empty>
{/if}
</div>
<svelte:fragment slot="empty">
<p>Create a new collection</p>
</svelte:fragment>
</CardContainer>
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {$collections.total}</p>
@@ -2,7 +2,7 @@
import { page } from '$app/stores';
import { goto } from '$app/navigation';
import { Button } from '$lib/elements/forms';
import { Empty, Pagination, Copy, GridItem1 } from '$lib/components';
import { Empty, Pagination, Copy, GridItem1, CardContainer } from '$lib/components';
import { Pill } from '$lib/elements';
import { Query, type Models } from '@aw-labs/appwrite-console';
import Create from './_create.svelte';
@@ -36,11 +36,7 @@
</div>
{#if $bucketList?.total}
<ul
class="grid-box common-section u-margin-block-start-32"
style={`--grid-gap:1.5rem; --grid-item-size:${
$bucketList.total > 3 ? '22rem' : '25rem'
};`}>
<CardContainer total={$bucketList.total} {offset} on:click={() => (showCreate = true)}>
{#each $bucketList.buckets as bucket}
<GridItem1 href={`${base}/console/project-${project}/storage/bucket/${bucket.$id}`}>
<svelte:fragment slot="eyebrow">XX Files</svelte:fragment>
@@ -81,12 +77,10 @@
</svelte:fragment>
</GridItem1>
{/each}
{#if $bucketList?.total < $cardLimit + offset && ($bucketList?.total % 2 !== 0 || $bucketList?.total % 4 === 0)}
<Empty isButton on:click={() => (showCreate = true)}>
<p>Add a new bucket</p>
</Empty>
{/if}
</ul>
<svelte:fragment slot="empty">
<p>Add a new bucket</p>
</svelte:fragment>
</CardContainer>
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {$bucketList.total}</p>