diff --git a/src/components/PCard/index.tsx b/src/components/PCard/index.tsx index 7ad4378..6c1d8ab 100644 --- a/src/components/PCard/index.tsx +++ b/src/components/PCard/index.tsx @@ -1,25 +1,16 @@ import * as S from './styles'; import { H16, P15 } from '@/components/Text'; import { Poster } from '@/components/Poster'; -import { CommonResponseType } from '@/types/apis'; +import { PItemType } from '@/types/pItem'; -interface PCardProps { - pInfo: Pick & - Partial>; - width?: string; -} - -export const PCard = ({ pInfo, width = '225px' }: PCardProps) => { - const poster = pInfo.rnum ? 'https://www.kopis.or.kr/' + pInfo.poster : pInfo.poster; - const place = pInfo.fcltynm ? pInfo.fcltynm : pInfo.prfnm; - const prf = pInfo.prfpd ? pInfo.prfpd : pInfo.prfpdfrom + '-' + pInfo.prfpdto; +export const PCard = ({ id, posterUrl, name, facility, period, rank, width = '225px' }: PItemType) => { return ( - + - {pInfo.prfnm} - {place} - {prf} + {name} + {facility} + {period} ); diff --git a/src/components/PCardGrid/index.tsx b/src/components/PCardGrid/index.tsx index ab351a4..aad74c6 100644 --- a/src/components/PCardGrid/index.tsx +++ b/src/components/PCardGrid/index.tsx @@ -1,29 +1,20 @@ import { PCard } from '@/components/PCard'; import * as S from './styles'; -import { CommonResponseType } from '@/types/apis'; +import { PItemType } from '@/types/pItem'; interface PCardGridProps { - pList: Pick[]; + pList: PItemType[]; width?: string; rows?: number; columns?: number; gap?: number; - isRanked?: boolean; } -export const PCardGrid = ({ - pList, - width = '600px', - rows = 1, - columns = 5, - gap = 10, - isRanked = false, -}: PCardGridProps) => { - console.log(typeof pList); +export const PCardGrid = ({ pList, width = '600px', rows = 1, columns = 5, gap = 10 }: PCardGridProps) => { return ( {pList.map((perform, index) => ( - + ))} ); diff --git a/src/components/PCardSlider/index.tsx b/src/components/PCardSlider/index.tsx index bf71af4..5502eb2 100644 --- a/src/components/PCardSlider/index.tsx +++ b/src/components/PCardSlider/index.tsx @@ -4,11 +4,10 @@ import 'slick-carousel/slick/slick-theme.css'; import * as S from './styles'; // import { CommonResponseType } from '@/types/apis'; import { PCard } from '@/components/PCard'; -import { CommonResponseType } from '@/types/apis'; +import { PItemType } from '@/types/pItem'; interface PCardSliderProps { - pList: (Pick & - Partial>)[]; + pList: PItemType[]; width?: string; } @@ -26,7 +25,7 @@ export const PCardSlider = ({ pList, width = '100%' }: PCardSliderProps) => { {pList.map((perform, index) => { - return ; + return ; })} diff --git a/src/types/pItem.ts b/src/types/pItem.ts new file mode 100644 index 0000000..763e702 --- /dev/null +++ b/src/types/pItem.ts @@ -0,0 +1,9 @@ +export type PItemType = { + id: string; + posterUrl: string; + name: string; + facility: string; + period: string; + rank?: number; + width?: string; +};