blanchon commited on
Commit
ecabf1e
1 Parent(s): 6d8d7d2

💫 chore: Add flip animation to Autocomplete, Gallery, and Saved Generations

Browse files
src/lib/components/models/autocomplete/Autocomplete.svelte CHANGED
@@ -3,6 +3,7 @@
3
  import type { ModelCard } from "$lib/type";
4
  import Icon from "@iconify/svelte";
5
  import Item from "./Item.svelte";
 
6
 
7
  export let defaultModels: ModelCard[] = [];
8
  export let onChange: (model: ModelCard | null) => void;
@@ -78,14 +79,16 @@
78
  >
79
  {#if search?.length >= 3}
80
  {#if models?.length > 0}
81
- {#each models as model}
82
- <Item
83
- model={model}
84
- onClick={() => {
85
- open = false;
86
- onChange(model)
87
- }}
88
- />
 
 
89
  {/each}
90
  {:else}
91
  <div class="flex items-center justify-center flex-col gap-2 p-3">
 
3
  import type { ModelCard } from "$lib/type";
4
  import Icon from "@iconify/svelte";
5
  import Item from "./Item.svelte";
6
+ import { flip } from 'svelte/animate';
7
 
8
  export let defaultModels: ModelCard[] = [];
9
  export let onChange: (model: ModelCard | null) => void;
 
79
  >
80
  {#if search?.length >= 3}
81
  {#if models?.length > 0}
82
+ {#each models as model (model.id)}
83
+ <span animate:flip={{ duration: 200 }}>
84
+ <Item
85
+ model={model}
86
+ onClick={() => {
87
+ open = false;
88
+ onChange(model)
89
+ }}
90
+ />
91
+ </span>
92
  {/each}
93
  {:else}
94
  <div class="flex items-center justify-center flex-col gap-2 p-3">
src/routes/gallery/+layout.svelte CHANGED
@@ -12,6 +12,7 @@
12
  import { userStore } from "$lib/stores/use-user";
13
  import { onMount } from "svelte";
14
  import type { CommunityCard } from "$lib/type";
 
15
 
16
  let data: {
17
  cards: CommunityCard[],
@@ -85,8 +86,13 @@
85
  </div>
86
  <!-- mx-auto grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-3 xl:grid-cols-4 3xl:grid-cols-5 gap-5 mt-8 lg:mt-10 -->
87
  <div class="mx-auto flex flex-wrap gap-5 mt-8 lg:mt-10 justify-center md:justify-start">
88
- {#each data.cards as card}
89
- <Card card={card} form={form} displayDelete={$userStore?.is_admin} />
 
 
 
 
 
90
  {/each}
91
  <InfiniteScroll
92
  elementScroll="{elementScroll ?? undefined}"
 
12
  import { userStore } from "$lib/stores/use-user";
13
  import { onMount } from "svelte";
14
  import type { CommunityCard } from "$lib/type";
15
+ import { flip } from "svelte/animate";
16
 
17
  let data: {
18
  cards: CommunityCard[],
 
86
  </div>
87
  <!-- mx-auto grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-3 xl:grid-cols-4 3xl:grid-cols-5 gap-5 mt-8 lg:mt-10 -->
88
  <div class="mx-auto flex flex-wrap gap-5 mt-8 lg:mt-10 justify-center md:justify-start">
89
+ {#each data.cards as card (card.id)}
90
+ <span
91
+ class="h-[400px] max-w-[400px] md:h-[350px] md:max-w-[350px] w-full"
92
+ animate:flip={{ duration: 200 }}
93
+ >
94
+ <Card {card} {form} displayDelete={$userStore?.is_admin} />
95
+ </span>
96
  {/each}
97
  <InfiniteScroll
98
  elementScroll="{elementScroll ?? undefined}"
src/routes/saved-generations/+page.svelte CHANGED
@@ -2,6 +2,7 @@
2
  import Card from "$lib/components/community/Card.svelte";
3
  import GoTop from "$lib/components/GoTop.svelte";
4
  import GalleryViewer from "$lib/components/community/viewer/Viewer.svelte";
 
5
 
6
  export let data
7
  </script>
@@ -16,8 +17,10 @@
16
  Saved generations ({data.total_items})
17
  </h1>
18
  <div class="mx-auto grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 2xl:grid-cols-4 gap-5 mt-8 lg:mt-10">
19
- {#each data.cards as card}
20
- <Card card={card} displayReactions={false} displayDelete={true} displayPublish={true} />
 
 
21
  {/each}
22
  <GoTop />
23
  </div>
 
2
  import Card from "$lib/components/community/Card.svelte";
3
  import GoTop from "$lib/components/GoTop.svelte";
4
  import GalleryViewer from "$lib/components/community/viewer/Viewer.svelte";
5
+ import { flip } from "svelte/animate";
6
 
7
  export let data
8
  </script>
 
17
  Saved generations ({data.total_items})
18
  </h1>
19
  <div class="mx-auto grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 2xl:grid-cols-4 gap-5 mt-8 lg:mt-10">
20
+ {#each data.cards as card (card.id)}
21
+ <div animate:flip={{ duration: 200 }}>
22
+ <Card {card} displayReactions={false} displayDelete={true} displayPublish={true} />
23
+ </div>
24
  {/each}
25
  <GoTop />
26
  </div>