Skip to content

Commit

Permalink
file :: kebabItems 파일분리
Browse files Browse the repository at this point in the history
  • Loading branch information
KANGYONGSU23 committed Nov 25, 2023
1 parent f7325b8 commit 4e30d48
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 66 deletions.
21 changes: 5 additions & 16 deletions src/components/company/CompanyTitle.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 (
<div className="flex items-center justify-between w-full">
Expand Down
52 changes: 2 additions & 50 deletions src/components/mypage/DetailProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="flex items-center gap-6">
<div className="w-[100px] h-[100px] rounded-[50%] shadow-elevaiton overflow-hidden flex items-center justify-center">
Expand All @@ -81,7 +33,7 @@ export default function DetailProfile() {
{profile && departmentEnum[profile.department]}
</p>
</div>
<KebabMenu items={kebabItems} />
<KebabMenu items={mypageKebabItems} />
</div>
);
}
73 changes: 73 additions & 0 deletions src/util/object/kebabMenuItems.ts
Original file line number Diff line number Diff line change
@@ -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();
},
},
];
};

0 comments on commit 4e30d48

Please sign in to comment.