diff --git a/src/components/recruitments/RecruitmentsCard.tsx b/src/components/recruitments/RecruitmentsCard.tsx index 866b68d..d4850f4 100644 --- a/src/components/recruitments/RecruitmentsCard.tsx +++ b/src/components/recruitments/RecruitmentsCard.tsx @@ -2,11 +2,12 @@ import { useSetBookmarks } from "@/apis/bookmarks"; import { useGetRecruitmentsList } from "@/apis/recruitments"; +import { RecruitmentsListType } from "@/apis/recruitments/type"; import { money_regex } from "@/util/regex"; import { Icon } from "@team-return/design-system"; import Image from "next/image"; import { useSearchParams } from "next/navigation"; -import React from "react"; +import React, { useState } from "react"; import HoverPrefetchLink from "../common/HoverPrefetchLink"; import RecruitmentSkelton from "../common/Skelton/SkeltonElement"; @@ -17,70 +18,74 @@ interface PropsType { export default function RecruitmentsCard({ maxLength = 12 }: PropsType) { const getParams = useSearchParams(); - const { data: recruitmentsList, isLoading } = useGetRecruitmentsList(getParams.toString()); - - const { mutate: SetBookmarksMutate } = useSetBookmarks(); + const { data: recruitmentsList, isLoading } = useGetRecruitmentsList( + getParams.toString() + ); return (
{isLoading && } {recruitmentsList?.recruitments .filter((_, idx) => idx < maxLength) - .map( - ( - { - company_profile_url, - company_name, - train_pay, - hiring_jobs, - bookmarked, - id, - military_support, - }, - index - ) => ( - -
-
- -
-
-

- {hiring_jobs} -

-

- {company_name} -

-
-
실습수당 {money_regex(train_pay)}원
- {military_support &&
병역특례
} -
- -
-
-
- ) - )} + .map((item) => { + return ; + })}
); } + +function RecruitmentsItem({ + company_profile_url, + company_name, + train_pay, + hiring_jobs, + bookmarked, + id, + military_support, +}: RecruitmentsListType) { + const { mutate: SetBookmarksMutate } = useSetBookmarks(); + const [localBookmarked, setLocalBookmarked] = useState( + bookmarked || false + ); + + return ( + +
+
+ +
+
+

+ {hiring_jobs} +

+

+ {company_name} +

+
+
실습수당 {money_regex(train_pay)}원
+ {military_support &&
병역특례
} +
+ +
+
+
+ ); +}