Skip to content

Commit

Permalink
refactor: 반복되는 부분 상수화하는 방법으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
smb0123 committed Sep 13, 2024
1 parent 72c778b commit 93fba74
Showing 1 changed file with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,32 @@ interface KanbanCardApplicantStatusLabelProps {
passState: "non-passed" | "first-passed" | "final-passed";
}

const labelConfig = {
"non-passed": {
backgroundColor: "bg-gray-300",
label: "처리중",
},
"first-passed": {
backgroundColor: "bg-lime-300",
label: "1차 합격",
},
"final-passed": {
backgroundColor: "bg-blue-300",
label: "최종 합격",
},
};

const KanbanCardApplicantStatusLabel = ({
passState,
}: KanbanCardApplicantStatusLabelProps) => {
switch (passState) {
case "non-passed":
return (
<div className="bg-gray-300 text-xs px-[10px] py-[5px] rounded-[10px]">
처리중
</div>
);
case "first-passed":
return (
<div className="bg-lime-300 text-xs px-[10px] py-[5px] rounded-[10px]">
1차 합격
</div>
);
case "final-passed":
return (
<div className="bg-blue-300 text-xs px-[10px] py-[5px] rounded-[10px]">
최종 합격
</div>
);
}
const { backgroundColor, label } = labelConfig[passState];
return (
<div
className={`${backgroundColor} text-xs px-[10px] py-[5px] rounded-[10px]`}
>
{label}
</div>
);
};

export default KanbanCardApplicantStatusLabel;

0 comments on commit 93fba74

Please sign in to comment.