Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions app/creators/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import CreatorsList from '@/ui/creatorsPage/CreatorsList';
import { searchCreatorsFromAlgolia } from '@/server/controllers/creators';
import { use, useState } from 'react';
import NavigationTab from '@/components/NavigationTab';
import { useSearchParams } from 'next/navigation';
import { useRouter, useSearchParams } from 'next/navigation';

export default function Page() {
const router = useRouter();
const searchParams = useSearchParams();
const [inputs, setInputs] = useState({
creators: '',
creators: searchParams.get('search') ?? '',
lectures: '',
});

Expand All @@ -22,11 +24,15 @@ export default function Page() {
});
};

const handleSearchButton = () => {
router.push(`/creators?search=${inputs.creators}`);
};

Comment on lines +27 to +30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저희 현재 UI 플로우 상, 강의 페이지(/lectures)와 크리에이터 페이지(/creators)에서 Input 클릭 시에는 검색 페이지로 redirect 하도록 되어있습니다 !

해당 페이지에서는 Input 컴포넌트의 value를 핸들링하는 handleChange와 검색 버튼을 눌렀을 때 핸들링하는 handleSearchButton는 제거되고, Input 컴포넌트 클릭시에 router.push('/search') 만 해줘도 될 것 같습니당

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 저는 검색 결과 나온 상태에선 라우팅 되는 거보다 페이지 내에서 검색 정보 입력되는 게 나아 보였는데요. 모바일 네이버 보니까 또 말씀 하신 게 맞는 거 같고요.. + 로 키워드 제안 되는 것도 생각하면 이동하는 게 맞아 보이네요. 말씀 주신 거에 맞춰서 변경하겠습니다. 👍

return (
<>
<PageLayout.TopFixed>
<Header />
<Input id="creators" value={inputs.creators} onChange={handleChange} placeholder="크리에이터 검색" />
<Input id="creators" value={inputs.creators} onChange={handleChange} placeholder="크리에이터 검색" onClickSearchButton={handleSearchButton} />
</PageLayout.TopFixed>
<PageLayout.Contents>
<NavigationTab />
Expand Down