Skip to content

Commit 4df63d2

Browse files
committed
feat: add slope status time
1 parent d3e5581 commit 4df63d2

File tree

3 files changed

+58
-6
lines changed

3 files changed

+58
-6
lines changed

src/shared/icons/close.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ const CloseIcon = ({ className, ...args }: CloseIconProps) => {
1616
className={className}
1717
{...args}
1818
>
19-
<path
20-
d="M17 7L7 17M17 17L7 7"
21-
stroke="currentColor"
22-
stroke-width="2"
23-
stroke-linecap="round"
24-
/>
19+
<path d="M17 7L7 17M17 17L7 7" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
2520
</svg>
2621
);
2722
};

src/views/slope-status/ui/slope-status-page.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { slopeApi } from '@/entities/slope';
1111
import type { Slope } from '@/entities/slope/model';
1212
import { RESORT_DOMAIN } from '@/entities/slope/model';
1313
import { cn } from '@/shared/lib';
14+
import SlopeStatusTime from '@/widgets/header/ui/slope-status-time';
1415

1516
const SlopeStatusPage = ({ resortId }: { resortId: number }) => {
1617
const { ref, style, containerRef } = useMapPinch();
@@ -30,6 +31,23 @@ const SlopeStatusPage = ({ resortId }: { resortId: number }) => {
3031
})) as Slope[],
3132
[slopeRawData, key]
3233
);
34+
const times = useMemo(
35+
() => ({
36+
day: {
37+
label: '주간',
38+
value: slopeRawData?.dayOperatingHours,
39+
},
40+
night: {
41+
label: '야간',
42+
value: slopeRawData?.nightOperatingHours,
43+
},
44+
lateNight: {
45+
label: '심야',
46+
value: slopeRawData?.lateNightOperatingHours,
47+
},
48+
}),
49+
[slopeRawData]
50+
);
3351

3452
if (!slopes) return;
3553

@@ -44,6 +62,7 @@ const SlopeStatusPage = ({ resortId }: { resortId: number }) => {
4462
slopes={slopes}
4563
/>
4664
</section>
65+
{Object.values(times).some((time) => time.value) && <SlopeStatusTime times={times} />}
4766
<SlopeStatusList resortId={resortId} slopes={slopes} />
4867
</main>
4968
);
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { cn } from '@/shared/lib';
2+
3+
type SlopeStatusTimeProps = {
4+
times: {
5+
day: {
6+
label: string;
7+
value?: string;
8+
};
9+
night: {
10+
label: string;
11+
value?: string;
12+
};
13+
lateNight: {
14+
label: string;
15+
value?: string;
16+
};
17+
};
18+
};
19+
20+
const SlopeStatusTime = ({ times }: SlopeStatusTimeProps) => {
21+
console.log(times);
22+
return (
23+
<div
24+
className={cn(
25+
'mx-[20px] mt-[26px] flex h-[65px] items-center justify-around rounded-[3px] border border-black/5 bg-gray-20 px-5 py-2.5'
26+
)}
27+
>
28+
{Object.entries(times).map(([key, value]) => (
29+
<div key={key} className={cn('flex w-[90px] flex-col items-center gap-2')}>
30+
<span className={cn('body1-semibold text-gray-60')}>{value.label}</span>
31+
<span className={cn('body1')}>{value.value || '-'}</span>
32+
</div>
33+
))}
34+
</div>
35+
);
36+
};
37+
38+
export default SlopeStatusTime;

0 commit comments

Comments
 (0)