diff --git a/src/components/company/CompanyTitle.tsx b/src/components/company/CompanyTitle.tsx index 260078e..a8b33e8 100644 --- a/src/components/company/CompanyTitle.tsx +++ b/src/components/company/CompanyTitle.tsx @@ -1,5 +1,6 @@ "use client"; +import { GetCompanyKebabItems } from "@/util/object/kebabMenuItems"; import { KebabItemType } from "@/util/type/kebabMenu"; import Image from "next/image"; import KebabMenu from "../common/Dropdown/KebabMenu"; @@ -21,22 +22,10 @@ export default function CompanyTitle({ onClickInterview, children, }: PropsType) { - - const kebabItems:KebabItemType[] = [ - { - label : '모집의뢰서 조회', - onClick: ()=>{ - onClickRecruitments && onClickRecruitments(); - } - }, - { - label : '면접 후기 조회', - onClick: ()=>{ - onClickInterview && onClickInterview(); - - } - } - ] + const kebabItems = GetCompanyKebabItems( + onClickRecruitments, + onClickInterview + ); return (
diff --git a/src/components/mypage/DetailProfile.tsx b/src/components/mypage/DetailProfile.tsx index d5828cd..448e7c8 100644 --- a/src/components/mypage/DetailProfile.tsx +++ b/src/components/mypage/DetailProfile.tsx @@ -2,62 +2,14 @@ import { MyProfile } from "@/apis/students"; import { departmentEnum } from "@/util/object/enum"; -import { KebabItemType } from "@/util/type/kebabMenu"; -import { useToastStore } from "@team-return/design-system"; +import { mypageKebabItems } from "@/util/object/kebabMenuItems"; import Image from "next/image"; -import { useRouter } from "next/navigation"; -import { Cookies } from "react-cookie"; import KebabMenu from "../common/Dropdown/KebabMenu"; import GhostTag from "./GhostTag"; export default function DetailProfile() { - const { append } = useToastStore(); - const navigator = useRouter(); - const cookies = new Cookies(); - const { data: profile } = MyProfile(); - const kebabItems: KebabItemType[] = [ - { - label: "프로필 수정", - onClick: () => { - append({ - title: "", - message: "개발 중인 기능입니다.", - type: "YELLOW", - }); - }, - }, - { - label: "비밀변호 변경", - onClick: () => { - append({ - title: "", - message: "개발 중인 기능입니다.", - type: "YELLOW", - }); - }, - }, - { - label: "버그 제보하기", - onClick: () => { - append({ - title: "", - message: "개발 중인 기능입니다.", - type: "YELLOW", - }); - }, - }, - { - label: "로그아웃", - onClick: () => { - navigator.push("/account/login"); - cookies.remove("access_token"); - cookies.remove("refresh_token"); - }, - }, - ]; - return (
@@ -81,7 +33,7 @@ export default function DetailProfile() { {profile && departmentEnum[profile.department]}

- +
); } diff --git a/src/util/object/kebabMenuItems.ts b/src/util/object/kebabMenuItems.ts new file mode 100644 index 0000000..49c8820 --- /dev/null +++ b/src/util/object/kebabMenuItems.ts @@ -0,0 +1,73 @@ +import { useToastStore } from "@team-return/design-system"; +import { useRouter } from "next/navigation"; +import { Cookies } from "react-cookie"; +import { KebabItemType } from "../type/kebabMenu"; + +export const mypageKebabItems: KebabItemType[] = [ + { + label: "프로필 수정", + onClick: () => { + const { append } = useToastStore(); + append({ + title: "", + message: "개발 중인 기능입니다.", + type: "YELLOW", + }); + }, + }, + { + label: "비밀변호 변경", + onClick: () => { + const { append } = useToastStore(); + + append({ + title: "", + message: "개발 중인 기능입니다.", + type: "YELLOW", + }); + }, + }, + { + label: "버그 제보하기", + onClick: () => { + const { append } = useToastStore(); + + append({ + title: "", + message: "개발 중인 기능입니다.", + type: "YELLOW", + }); + }, + }, + { + label: "로그아웃", + onClick: () => { + const navigator = useRouter(); + const cookies = new Cookies(); + + navigator.push("/account/login"); + cookies.remove("access_token"); + cookies.remove("refresh_token"); + }, + }, +]; + +export const GetCompanyKebabItems = ( + onClickRecruitments?: () => void, + onClickInterview?: () => void +): KebabItemType[] => { + return [ + { + label: "모집의뢰서 조회", + onClick: () => { + onClickRecruitments && onClickRecruitments(); + }, + }, + { + label: "면접 후기 조회", + onClick: () => { + onClickInterview && onClickInterview(); + }, + }, + ]; +};