diff --git a/src/entities/slope/model/index.ts b/src/entities/slope/model/index.ts index 8bdc932..164a07a 100644 --- a/src/entities/slope/model/index.ts +++ b/src/entities/slope/model/index.ts @@ -1 +1 @@ -export type { Slope, Webcam, SlopeResponse } from './model'; +export type { Level, Slope, Webcam, SlopeResponse } from './model'; diff --git a/src/entities/slope/model/model.d.ts b/src/entities/slope/model/model.d.ts index 2759185..80e89a1 100644 --- a/src/entities/slope/model/model.d.ts +++ b/src/entities/slope/model/model.d.ts @@ -1,6 +1,14 @@ +export type Level = + | '초급' + | '초중급' + | '중급' + | '중상급' + | '상급' + | '최상급'; + export type Slope = { name: string, - difficulty: string, + difficulty: Level, isDayOperating: true, isNightOperating: true, isLateNightOperating: true, diff --git a/src/entities/slope/ui/level-chip.tsx b/src/entities/slope/ui/level-chip.tsx new file mode 100644 index 0000000..fddc8a4 --- /dev/null +++ b/src/entities/slope/ui/level-chip.tsx @@ -0,0 +1,51 @@ +import React from 'react'; +import { cn } from '../../../shared/lib'; +import type { Level } from '../model'; + +const LEVEL: Record = { + 초급: { + text: '초급', + color: 'bg-sub-2', + }, + 초중급: { + text: '초중급', + color: 'bg-sub-2', + }, + 중급: { + text: '중급', + color: 'bg-sub-4', + }, + 중상급: { + text: '중상급', + color: 'bg-sub-4', + }, + 상급: { + text: '상급', + color: 'bg-gray-70', + }, + 최상급: { + text: '최상급', + color: 'bg-gray-70', + }, +}; + +interface LevelChipProps { + className?: string; + level: Level; +} + +const LevelChip = ({ level, className }: LevelChipProps) => { + return ( +
+

{LEVEL[level].text}

+
+ ); +}; + +export default LevelChip; diff --git a/src/features/slop/ui/slop-status-list.tsx b/src/features/slop/ui/slop-status-list.tsx index e5119a8..b644ba9 100644 --- a/src/features/slop/ui/slop-status-list.tsx +++ b/src/features/slop/ui/slop-status-list.tsx @@ -1,23 +1,16 @@ import React from 'react'; -import type { Level } from '@/entities/slop/model/model'; -import LevelChip from '@/entities/slop/ui/level-chip'; +import type { Slope } from '@/entities/slope'; +import LevelChip from '@/entities/slope/ui/level-chip'; import CheckIcon from '@/shared/icons/check'; import CloseIcon from '@/shared/icons/close'; import { cn } from '@/shared/lib'; import useSlopStore from '../hooks/useSlopStore'; interface SlopStatusListProps { - list: { - key: string; - name: string; - level: Level; - isOpenDuringDay: boolean; - isOpenDuringWeek: boolean; - isOpenDuringNight: boolean; - }[]; + slopes?: Slope[]; } -const SlopStatusList = ({ list }: SlopStatusListProps) => { +const SlopStatusList = ({ slopes }: SlopStatusListProps) => { const { selectedSlop, setSelectedSlop } = useSlopStore(); const handleSlopClick = ({ id }: { id: string }) => { @@ -47,26 +40,26 @@ const SlopStatusList = ({ list }: SlopStatusListProps) => { - {list.map((item) => ( + {slopes?.map((slope) => ( handleSlopClick({ id: item.key })} + key={slope.name} + className={cn(selectedSlop === slope.name && 'bg-main-5')} + onClick={() => handleSlopClick({ id: slope.name })} > - {item.name} + {slope.name} - + - + - + - + ))} diff --git a/src/views/slop-status/ui/slop-status-page.tsx b/src/views/slop-status/ui/slop-status-page.tsx index 4ce65bd..8fd9d69 100644 --- a/src/views/slop-status/ui/slop-status-page.tsx +++ b/src/views/slop-status/ui/slop-status-page.tsx @@ -20,7 +20,6 @@ const SlopStatusPage = ({ const { ref, style, containerRef } = useMapPinch(); const { data: slopeData } = useQuery(slopeApi.slopeQueries.slope(resortId ?? 1)); - console.log(slopeData); const { data } = useQuery(slopQueries.list(params?.key ?? 'jisan')); @@ -37,7 +36,7 @@ const SlopStatusPage = ({ slops={RESORT_DOMAIN[data.key].slops} /> - + ); };