Skip to content

Commit

Permalink
🐛 fix: const enum을 사용하지 못하는 경우 as const로 대체하기 #15
Browse files Browse the repository at this point in the history
  • Loading branch information
naarang committed Oct 23, 2024
1 parent d5f417d commit 5ca7661
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/components/PostSearch/PostSearchResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,25 @@ const JOB_POSTING_LIST: JobPostingItemType[] = [
},
];

enum SORT_TYPE {
POPULAR = 'Popular',
RECOMMENDED = 'Recommended',
RECENT = 'Recent',
}
const SORT_TYPE = {
POPULAR: 'Popular',
RECOMMENDED: 'Recommended',
RECENT: 'Recent',
} as const;

type SortType = (typeof SORT_TYPE)[keyof typeof SORT_TYPE];

const PostSearchResult = () => {
// TODO: 홈에서 See more 버튼 클릭 시 해당 메뉴로 정렬하기
const [selectedSort, setSelectedSort] = useState<SORT_TYPE>(
SORT_TYPE.POPULAR,
);
const [selectedSort, setSelectedSort] = useState<SortType>(SORT_TYPE.POPULAR);
return (
<section className="flex flex-col items-center gap-[1rem] w-full mt-[1rem] px-[1.5rem]">
<div className="w-full flex justify-between items-center">
<h3 className="head-3 text-black">Search Result</h3>
<PostSearchSortDropdown
options={Object.values(SORT_TYPE)}
value={selectedSort}
onSelect={(sort) => setSelectedSort(sort as SORT_TYPE)}
onSelect={(sort) => setSelectedSort(sort as SortType)}
/>
</div>
{JOB_POSTING_LIST?.length ? (
Expand Down

0 comments on commit 5ca7661

Please sign in to comment.