Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 지원현황/면접기록 목록페이지에서 합불상태를 조회할 수 있다. #213

Merged
merged 13 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/components/applicant/Board.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const ApplicantBoard = ({ generation }: ApplicantBoardProps) => {

return (
<Board
wapperClassname="divide-x"
wrapperClassname="divide-x"
boardData={createSearchData(true) ?? boardData}
onClick={onClick}
>
Expand Down
68 changes: 12 additions & 56 deletions frontend/components/common/board/Board.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

import { PropsWithChildren, useState } from "react";
import BoardCell from "./BoardCell.component";
import Modal from "react-modal";
import Image from "next/image";
import CloseImage from "/public/icons/ellipsis.multiply.svg";
import { cn } from "@/src/utils/cn";
import Txt from "../Txt.component";
import useModalState from "../../../src/hooks/useModalState";
import BoardModal from "./BoardModal";
import BoardTable from "./BoardTable";

interface BoardData {
export interface BoardData {
id: string;
title: string;
subElements: string[];
Expand All @@ -18,33 +16,14 @@ interface BoardData {

interface BoardProps extends PropsWithChildren {
onClick?: (id: string) => void;
wapperClassname?: string;
wrapperClassname?: string;
boardData: BoardData[];
}

const modalStyle = {
content: {
width: "calc(100% - 12rem)",
zIndex: "9999",
height: "calc(100%)",
margin: "3rem 6rem 0 6rem",
minWidth: "1280px",
boxShadow: "0px 0px 6px 1px rgba(0, 0, 0, 0.14)",
border: "none",
position: "relative",
inset: "0",
padding: "2.5rem 3rem",
},
overlay: {
padding: "0",
position: "absolute",
},
} as const;

const Board = ({
children,
onClick,
wapperClassname,
wrapperClassname,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrapperClassName으로 작성하는게 좋아보입니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오타 제보 감사용 .

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boardData,
}: BoardProps) => {
const { isOpen, openModal, closeModal } = useModalState();
Expand All @@ -55,40 +34,17 @@ const Board = ({
};

return (
<section className="flex flex-col">
{boardData.length === 0 ? (
<Txt>검색결과가 없습니다.</Txt>
) : (
<>
{boardData.map((item) => (
<BoardCell
key={item.id}
title={item.title}
subElements={item.subElements}
onClick={handleModalOpen(item.id)}
/>
))}
</>
)}
<Modal
style={modalStyle}
<>
<BoardTable boardRows={boardData} handleModalOpen={handleModalOpen} />
<BoardModal
isOpen={isOpen}
onRequestClose={closeModal}
ariaHideApp={false}
wrapperClassname={wrapperClassname}
>
<button className="absolute z-10" onClick={closeModal}>
<Image src={CloseImage} alt="close" />
</button>
<div
className={cn(
"flex pt-8 absolute h-[calc(100%-6rem)] w-[calc(100%-6rem)]",
wapperClassname
)}
>
{children}
</div>
</Modal>
</section>
{children}
</BoardModal>
</>
);
};

Expand Down
52 changes: 52 additions & 0 deletions frontend/components/common/board/BoardModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import Modal from "react-modal";
import CloseImage from "/public/icons/ellipsis.multiply.svg";
import Image from "next/image";
import { cn } from "@/src/utils/cn";

const modalStyle = {
content: {
width: "calc(100% - 12rem)",
zIndex: "9999",
height: "calc(100%)",
margin: "3rem 6rem 0 6rem",
minWidth: "1280px",
boxShadow: "0px 0px 6px 1px rgba(0, 0, 0, 0.14)",
border: "none",
position: "relative",
inset: "0",
padding: "2.5rem 3rem",
},
overlay: {
padding: "0",
position: "absolute",
},
} as const;

interface BoardModalProps extends Modal.Props {
wrapperClassname?: string;
}

const BoardModal = ({
wrapperClassname,
style,
children,
...props
}: BoardModalProps) => {
return (
<Modal style={{ ...modalStyle, ...style }} {...props}>
<button className="absolute z-10" onClick={props.onRequestClose}>
<Image src={CloseImage} alt="close" />
</button>
<div
className={cn(
"flex pt-8 absolute h-[calc(100%-6rem)] w-[calc(100%-6rem)]",
wrapperClassname
)}
>
{children}
</div>
</Modal>
);
};

export default BoardModal;
30 changes: 30 additions & 0 deletions frontend/components/common/board/BoardTable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Txt from "../Txt.component";
import { BoardData } from "./Board";
import BoardCell from "./BoardCell.component";

interface BoardTableProps {
boardRows: BoardData[];
handleModalOpen: (id: string) => () => void;
}
const BoardTable = ({ boardRows, handleModalOpen }: BoardTableProps) => {
return (
<section className="flex flex-col">
{boardRows.length === 0 ? (
<Txt>검색결과가 없습니다.</Txt>
) : (
<>
{boardRows.map((item) => (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 부분 item. 이 반복되는 것 같아, ({id, title, subElements, passState,}) => {} 형태로 작성해도 좋아보입니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋네요 ! 수정해보도록 하겠습니다 :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<BoardCell
key={item.id}
title={item.title}
subElements={item.subElements}
onClick={handleModalOpen(item.id)}
/>
))}
</>
)}
</section>
);
};

export default BoardTable;
2 changes: 1 addition & 1 deletion frontend/components/interview/Board.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const InterviewBoard = ({ generation }: InterviewBoardProps) => {

return (
<Board
wapperClassname="divide-x"
wrapperClassname="divide-x"
boardData={createSearchData() ?? boardData}
onClick={(id) => onClick(id)}
>
Expand Down