enzostvs HF staff commited on
Commit
83d9f5e
·
1 Parent(s): cc92c83

empty state + click outside

Browse files
src/lib/components/models/drawer/Drawer.svelte CHANGED
@@ -1,4 +1,6 @@
1
  <script lang="ts">
 
 
2
  import { get } from "svelte/store";
3
  import Icon from "@iconify/svelte";
4
 
@@ -25,6 +27,7 @@
25
  <div
26
  class="ml-auto w-full max-w-3xl bg-neutral-950 h-full border-l border-neutral-800 transition-all duration-200 flex flex-col justify-between"
27
  class:translate-x-full={!data?.id}
 
28
  >
29
  <div class="p-8 overflow-auto">
30
  <header class="flex w-full justify-between items-start mb-6">
 
1
  <script lang="ts">
2
+ import { clickoutside } from '@svelte-put/clickoutside';
3
+
4
  import { get } from "svelte/store";
5
  import Icon from "@iconify/svelte";
6
 
 
27
  <div
28
  class="ml-auto w-full max-w-3xl bg-neutral-950 h-full border-l border-neutral-800 transition-all duration-200 flex flex-col justify-between"
29
  class:translate-x-full={!data?.id}
30
+ use:clickoutside on:clickoutside={handleClose}
31
  >
32
  <div class="p-8 overflow-auto">
33
  <header class="flex w-full justify-between items-start mb-6">
src/lib/components/models/drawer/comments/Comments.svelte CHANGED
@@ -37,6 +37,9 @@
37
 
38
  <div>
39
  <div class="grid grid-cols-1 gap-3">
 
 
 
40
  {#each comments as comment}
41
  <Comment comment={comment} />
42
  {/each}
 
37
 
38
  <div>
39
  <div class="grid grid-cols-1 gap-3">
40
+ {#if comments?.length === 0}
41
+ <p class="text-neutral-500 text-sm">No comments yet! Be the first one!</p>
42
+ {/if}
43
  {#each comments as comment}
44
  <Comment comment={comment} />
45
  {/each}