Skip to content

Commit

Permalink
feat:add search (#343)
Browse files Browse the repository at this point in the history
Signed-off-by: laixingyou <laixy7@gmail.com>
  • Loading branch information
coder-sett authored Apr 10, 2024
1 parent 8beaa7f commit 4c8badd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion apps/web/src/modules/collection/MainContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ const MainContent = ({

const [keyword, setKeyword] = useState('');
const [sort, setSort] = useState('');

useEffect(() => {
setKeyword('');
}, [slug, router]);
const params = {
ident: slug,
page: 1,
Expand Down
6 changes: 4 additions & 2 deletions apps/web/src/modules/collection/MainHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next';
import { Collection } from '@modules/explore/type';
Expand Down Expand Up @@ -39,7 +39,9 @@ const MainHeader = ({
});
const collection = ident ? collectionsMap[ident] : null;
const [value, setValue] = useState(keyword);

useEffect(() => {
setValue('');
}, [ident]);
useHotkeys(
'enter',
(e, he) => {
Expand Down

0 comments on commit 4c8badd

Please sign in to comment.