From 07b9317e654611fc6803e23eabea6069f88e567c Mon Sep 17 00:00:00 2001 From: ohinhyuk <8156217@naver.com> Date: Wed, 23 Aug 2023 00:59:09 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20=EB=A7=88=EC=9D=BC=EB=A6=AC=EC=A7=80=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EA=B2=8C=EC=8B=9C=ED=8C=90=20enum=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95(#4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/data/fields.ts | 3 +- src/components/board/MileageView.tsx | 146 +++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 src/components/board/MileageView.tsx diff --git a/src/assets/data/fields.ts b/src/assets/data/fields.ts index 1ab5a02..d94297f 100644 --- a/src/assets/data/fields.ts +++ b/src/assets/data/fields.ts @@ -9,7 +9,8 @@ export const ISVISIBLE = 'isVisible'; export const REGISTERED_DATE = 'registeredDate'; // export const TITLE = 'title'; export const ITEM = 'item'; -export const NAME = 'name'; +// export const NAME = 'name'; +export const STUDENT_NAME = 'studentName'; export const POINT = 'point'; export const DESCRIPTION = 'description'; export const STUDENT_ID = 'studentId'; diff --git a/src/components/board/MileageView.tsx b/src/components/board/MileageView.tsx new file mode 100644 index 0000000..d240929 --- /dev/null +++ b/src/components/board/MileageView.tsx @@ -0,0 +1,146 @@ +import { StarIcon } from 'src/theme/overrides/CustomIcons'; +import EnhancedTable from '../common/CustomTable'; +import { + NUM, + CATEGORY, + SEMESTER, + ITEM, + STUDENT_ID, + STUDENT_NAME, + POINT, + REGISTERED_DATE, +} from 'src/assets/data/fields'; + +/** + * @component [마일리지 조회] 게시판 + */ + +/** + * @kind [마일리지 조회] + * @breif enum + */ + +export enum MileageViewBoard { + 'NUM' = NUM, + 'CATEGORY' = CATEGORY, + 'SEMESTER' = SEMESTER, + 'ITEM' = ITEM, + 'STUDENT_ID' = STUDENT_ID, + 'STUDENT_NAME' = STUDENT_NAME, + 'POINT' = POINT, + 'REGISTERED_DATE' = REGISTERED_DATE, +} + +/** + * @kind [마일리지 항목] + * @breif 데이터 인터페이스 + */ +interface Data { + [MileageItemBoard.CATEGORY]: string; + [MileageItemBoard.SEMESTER]: number; + [MileageItemBoard.ITEM]: string; + [MileageItemBoard.MILEAGE]: number; + [MileageItemBoard.ISVISIBLE]: boolean; + [MileageItemBoard.REGISTERED_DATE]: string; + [MileageItemBoard.MANAGE]: string; +} + +export default function MileageItem() { + /** + * @kind [마일리지 항목] + * @brief 데이터 생성 함수 + * + * */ + function createData( + num: number, + category: string, + semester: number, + item: string, + mileage: number, + isVisible: boolean, + registeredDate: string, + manage: string + ): Data { + return { + [MileageItemBoard.NUM]: num, + [MileageItemBoard.CATEGORY]: category, + [MileageItemBoard.SEMESTER]: semester, + [MileageItemBoard.ITEM]: item, + [MileageItemBoard.MILEAGE]: mileage, + [MileageItemBoard.ISVISIBLE]: isVisible, + [MileageItemBoard.REGISTERED_DATE]: registeredDate, + [MileageItemBoard.MANAGE]: manage, + }; + } + + /** + * @kind [마일리지 항목] + * @brief 테이블 헤더 + */ + const headCells = [ + { + id: [MileageItemBoard.NUM], + numeric: false, + disablePadding: true, + label: '번호', + }, + { + id: [MileageItemBoard.CATEGORY], + numeric: true, + disablePadding: false, + label: '카테고리명', + }, + { + id: [MileageItemBoard.SEMESTER], + numeric: true, + disablePadding: false, + label: '학기', + }, + { + id: [MileageItemBoard.ITEM], + numeric: true, + disablePadding: false, + label: '항목명', + }, + { + id: [MileageItemBoard.MILEAGE], + numeric: true, + disablePadding: false, + label: '마일리지', + }, + { + id: [MileageItemBoard.ISVISIBLE], + numeric: true, + disablePadding: false, + label: '보이기', + }, + { + id: [MileageItemBoard.REGISTERED_DATE], + numeric: true, + disablePadding: false, + label: '등록일', + }, + { + id: [MileageItemBoard.MANAGE], + numeric: true, + disablePadding: false, + label: '관리', + }, + ]; + + /** + * @number 1번 목록 + * @description 마일리지 항목 리스트 + */ + + const rows = [ + createData(1, '전공 마일리지', 7, '웹 서비스 캠프', 30, 'y', '2023-08-21', ), + createData(2, '비교과 - 연구활동', 6, '웹 서비스 캠프', 30, 'y', '2023-08-21', ), + createData(3, '비교과 - 전공활동', 6, '웹 서비스 캠프', 30, 'y', '2023-08-21', ), + createData(4, '비교과 - 특강참여', 7, '웹 서비스 캠프', 30, 'y', '2023-08-21', ), + createData(5, '비교과 - 학회활동', 6, '웹 서비스 캠프', 30, 'y', '2023-08-21', ), + createData(6, '비교과 - 행사참여', 8, '웹 서비스 캠프', 30, 'y', '2023-08-21', ), + ]; + + return ; +}