enzostvs HF staff commited on
Commit
c79601a
·
1 Parent(s): f3dac82

fix: clicking on author

Browse files
src/lib/components/models/drawer/Drawer.svelte CHANGED
@@ -10,6 +10,7 @@
10
  import Comments from '$lib/components/models/drawer/comments/Comments.svelte';
11
 
12
  let { open, model } = get(modelStore);
 
13
 
14
  $: author = model?.id.split('/')[0];
15
  $: repo = model?.id.split('/')[1];
@@ -46,6 +47,7 @@
46
  };
47
  const handleClickAuthor = async () => {
48
  $page.url.searchParams.set('search', author as string);
 
49
  handleClose();
50
  }
51
  </script>
 
10
  import Comments from '$lib/components/models/drawer/comments/Comments.svelte';
11
 
12
  let { open, model } = get(modelStore);
13
+ export let onSearch: (search: string) => void;
14
 
15
  $: author = model?.id.split('/')[0];
16
  $: repo = model?.id.split('/')[1];
 
47
  };
48
  const handleClickAuthor = async () => {
49
  $page.url.searchParams.set('search', author as string);
50
+ onSearch(author as string);
51
  handleClose();
52
  }
53
  </script>
src/routes/+page.svelte CHANGED
@@ -73,7 +73,7 @@
73
  data.models = response.cards;
74
  data.total_items = response.total_items;
75
  }
76
- }
77
  </script>
78
 
79
  <svelte:head>
@@ -85,7 +85,7 @@
85
  <Dialog open={submitModelDialog} onClose={() => submitModelDialog = false}>
86
  <SubmitModel onClose={() => submitModelDialog = false} />
87
  </Dialog>
88
- <Drawer />
89
  <h1 class="text-white font-semibold text-2xl">
90
  Explore Models ({data?.total_items ?? 0})
91
  </h1>
 
73
  data.models = response.cards;
74
  data.total_items = response.total_items;
75
  }
76
+ }
77
  </script>
78
 
79
  <svelte:head>
 
85
  <Dialog open={submitModelDialog} onClose={() => submitModelDialog = false}>
86
  <SubmitModel onClose={() => submitModelDialog = false} />
87
  </Dialog>
88
+ <Drawer onSearch={handleChangeSearch} />
89
  <h1 class="text-white font-semibold text-2xl">
90
  Explore Models ({data?.total_items ?? 0})
91
  </h1>