Skip to content

Commit b39255f

Browse files
committed
fix/options/type-error
1 parent 7a7a968 commit b39255f

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

src/pages/map/components/CourseInputSection.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import { Icon } from '@/shared/icons';
24

35
interface CourseInputSectionProps {

src/pages/map/components/CourseSelectSection.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import CommonButton from '@/shared/components/button/CommonButton';
24

35
interface CourseSelectSectionProps {
@@ -13,7 +15,7 @@ export default function CourseSelectSection({
1315
selected,
1416
onSelect,
1517
}: CourseSelectSectionProps) {
16-
const sectionId = `${title.replace(/\s+/g, '-')}-group`;
18+
const sectionId = `${(title ?? '').replace(/\s+/g, '-')}-group`;
1719

1820
return (
1921
<section
@@ -37,16 +39,17 @@ export default function CourseSelectSection({
3739
style={{ WebkitOverflowScrolling: 'touch' }}
3840
role="list"
3941
>
40-
{options.map(({ id, label }) => (
41-
<CommonButton
42-
key={id}
43-
label={label}
44-
aria-pressed={selected === id}
45-
aria-label={`${label} 선택`}
46-
role="listitem"
47-
variant={selected === id ? 'active' : 'default'}
48-
onClick={() => onSelect(selected === id ? null : id)}
49-
/>
42+
{Array.isArray(options) &&
43+
options.map(({ id, label }) => (
44+
<CommonButton
45+
key={id}
46+
label={label}
47+
aria-pressed={selected === id}
48+
aria-label={`${label} 선택`}
49+
role="button"
50+
variant={selected === id ? 'active' : 'default'}
51+
onClick={() => onSelect(selected === id ? null : id)}
52+
/>
5053
))}
5154
</div>
5255

src/pages/map/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { BottomNav } from '@/shared/components/tab/BottomNav';
55
import { purposes, stays, moves } from '@/shared/constants/course/courseOptions';
66
import { useCourseSelection } from '@/shared/hooks/useCourseSelection';
77
import CourseSelectSection from '@/pages/map/components/CourseSelectSection';
8-
import { useRouter } from 'next/navigation';
8+
import { useRouter } from 'next/router';
99
import CourseInputSection from '@/pages/map/components/CourseInputSection';
1010

1111
export default function CourseSettingPage() {
@@ -17,7 +17,7 @@ export default function CourseSettingPage() {
1717

1818
const handleNext = () => {
1919
if (!canProceed) return alert('모든 항목을 선택해주세요.');
20-
router.push('/map/result');
20+
router.push('/result');
2121
};
2222

2323
return (

src/shared/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export { default as Header } from './header/Header';
22
export { default as ControlBar } from './header/ControlBar';
33
export { default as Tag } from './tag/Tag';
44
export { DatePicker } from './datePicker/DatePicker';
5+
export { default as CommonButton } from './button/CommonButton';

0 commit comments

Comments
 (0)