Skip to content

Commit

Permalink
Feat: 마일리지 항목 게시판 enum 설정 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohinhyuk committed Aug 21, 2023
1 parent e89dca2 commit 181dee6
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/assets/data/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export const SEMESTER = 'semester';
export const MILEAGE = 'mileage';
export const ISVISIBLE = 'isVisible';
export const REGISTERED_DATE = 'registeredDate';
export const TITLE = 'title';
// export const TITLE = 'title';
export const ITEM = 'item';
export const NAME = 'name';
export const POINT = 'point';
export const DESCRIPTION = 'description';
Expand Down
109 changes: 109 additions & 0 deletions src/components/board/MileageItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import EnhancedTable from "../common/CustomTable";
import { MILEAGE, ISVISIBLE, REGISTERED_DATE ,MANAGE, CHECK_BOX, NUM, CATEGORY ,SEMESTER, ITEM} from 'src/assets/data/fields';

export default function MileageItem(){


/**
* @breif [마일리지 카테고리] 게시판
*/

export enum MileageItemBoard {
'NUM' = NUM,
'CATEGORY' = CATEGORY,
'SEMESTER' = SEMESTER,
'ITEM' = ITEM,
'MILEAGE' = MILEAGE,
'ISVISIBLE' = ISVISIBLE,
'REGISTERED_DATE'= REGISTERED_DATE,
'MANAGE' = MANAGE,
'CHECK_BOX' = CHECK_BOX,
}

/**
* @kind 마일리지 카테로리
* @breif 데이터 인터페이스
*/
interface Data {
[MileageItemBoard.CATEGORY]: string;
[MileageItemBoard.MAX_MILEAGE]: number;
[MileageItemBoard.MANAGE]: string;
[MileageItemBoard.CHECK_BOX]: string;
}

/**
* @kind 마일리지 카테고리
* @brief 데이터 생성 함수
*
* */
function createData(
num: number,
category: string,
maxMileage: number,
manage: string,
checkBox: string
): Data {
return {
[MileageCategoryBoard.NUM]: num,
[MileageCategoryBoard.CATEGORY]: category,
[MileageCategoryBoard.MAX_MILEAGE]: maxMileage,
[MileageCategoryBoard.MANAGE]: manage,
[MileageCategoryBoard.CHECK_BOX]: checkBox,
};
}

/**
* @number 1번 헤더
* @description 마일리지 카테고리 리스트
*/
const headCells = [
{
id: [MileageCategoryBoard.NUM],
numeric: false,
disablePadding: true,
label: '번호',
},
{
id: [MileageCategoryBoard.CATEGORY],
numeric: true,
disablePadding: false,
label: '카테고리명',
},
{
id: [MileageCategoryBoard.MAX_MILEAGE],
numeric: true,
disablePadding: false,
label: '최대 마일리지',
},
{
id: [MileageCategoryBoard.MANAGE],
numeric: true,
disablePadding: false,
label: '관리',
},
{
id: [MileageCategoryBoard.CHECK_BOX],
numeric: true,
disablePadding: false,
label: '체크',
},
];

/**
* @number 1번 목록
* @description 마일리지 카테고리 리스트
*/

const rows = [
createData(1, '전공 마일리지', 7, '웹 서비스 캠프', <StarIcon />),
createData(2, '비교과 - 연구활동', 6, '웹 서비스 캠프', <StarIcon />),
createData(3, '비교과 - 전공활동', 6, '웹 서비스 캠프', <StarIcon />),
createData(4, '비교과 - 특강참여', 7, '웹 서비스 캠프', <StarIcon />),
createData(5, '비교과 - 학회활동', 6, '웹 서비스 캠프', <StarIcon />),
createData(6, '비교과 - 행사참여', 8, '웹 서비스 캠프', <StarIcon />),
];

return (
<EnhancedTable type="마일리지 카테고리" rows={rows} headCells={headCells} />;
);
}
8 changes: 8 additions & 0 deletions src/components/common/Table/TableComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { Board } from 'src/assets/data/board/board';
import EnhancedTable from '../CustomTable';
import MileageCategory from 'src/components/board/MileageCategory';
import SearchIcon from '@mui/icons-material/Search';
import InputIcon from '@mui/icons-material/Input';
import AssignmentIndIcon from '@mui/icons-material/AssignmentInd';
import Face6Icon from '@mui/icons-material/Face6';
import PersonIcon from '@mui/icons-material/Person';
import DonutSmallIcon from '@mui/icons-material/DonutSmall';
import GavelIcon from '@mui/icons-material/Gavel';
import SettingsIcon from '@mui/icons-material/Settings';

export const ComponentReturn = (text) => {
switch (text) {
Expand Down

0 comments on commit 181dee6

Please sign in to comment.