Skip to content

Commit aaade89

Browse files
authored
Fix/youl storybook + 노데이터 문구 수정 (#174)
* 📝 Docs: 스토리북 수정, Refactor: 안쓰는 타입 수정 * 📝 Docs: jsdoc 추가
1 parent 29067b2 commit aaade89

File tree

13 files changed

+247
-43
lines changed

13 files changed

+247
-43
lines changed

package-lock.json

Lines changed: 120 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/(crew)/_components/hero/hero-crew.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function HeroCrew() {
1717
<strong className="text-sm font-medium text-gray-700 md:text-base">
1818
함께할 사람이 없나요?
1919
</strong>
20-
<strong className="text-2xl font-semibold text-gray-900 md:text-3.5xl">
20+
<strong className="text-xl font-semibold text-gray-900 md:text-3xl">
2121
지금 크루에 참여해보세요.
2222
</strong>
2323
</p>

src/app/(crew)/crew/create/_components/create-crew-form/create-crew-form.stories.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,27 @@ export default {
1717
title: 'crew/create-crew-form',
1818
component: CreateCrewForm,
1919
tags: ['autodocs'],
20+
argTypes: {
21+
type: {
22+
control: 'radio',
23+
options: ['create', 'edit'],
24+
description: '폼 타입',
25+
table: { type: { summary: 'create | edit' } },
26+
},
27+
data: {
28+
control: 'object',
29+
description: '폼 데이터',
30+
table: { type: { summary: 'CreateCrewFormTypes' } },
31+
},
32+
isEdit: { control: 'boolean', description: '수정 여부' },
33+
onSubmit: {
34+
action: 'submit',
35+
table: { type: { summary: '(data: CreateCrewFormTypes) => void' } },
36+
},
37+
onEdit: { action: 'edit', table: { type: { summary: '(data: CreateCrewFormTypes) => void' } } },
38+
},
2039
parameters: {
2140
layout: 'fullscreen',
22-
nextjs: {
23-
appDirectory: true,
24-
},
2541
docs: {
2642
description: {
2743
component: '크루 작성/수정에 사용되는 폼입니다.',

src/app/(crew)/crew/create/_components/create-crew-form/index.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,26 @@ import DropDown from '@/src/components/common/input/drop-down';
1313
import FileInputWrap from '@/src/components/common/input/file-input-wrap';
1414
import TextInput from '@/src/components/common/input/text-input';
1515
import Textarea from '@/src/components/common/input/textarea';
16-
import { CreateCrewFormTypes, EditCrewResponseTypes } from '@/src/types/create-crew';
16+
import { CreateCrewFormTypes } from '@/src/types/create-crew';
1717
import ImgCrewSampleUrls from '@/public/assets/images/crew-sample';
1818

1919
export interface CreateCrewFormProps {
2020
type: 'create' | 'edit';
21-
data: CreateCrewFormTypes | EditCrewResponseTypes;
21+
data: CreateCrewFormTypes;
2222
isEdit?: boolean;
2323
onEdit?: (data: CreateCrewFormTypes) => void;
2424
onSubmit?: (data: CreateCrewFormTypes) => void;
2525
}
2626

27+
/**
28+
* 크루 생성/수정 폼
29+
* @param {'create' | 'edit'} type : form 타입
30+
* @param {boolean} isEdit : 수정 여부
31+
* @param {(data: CreateCrewFormTypes) => void} onEdit
32+
* @param {(data: CreateCrewFormTypes) => void} onSubmit
33+
* @param {CreateCrewFormTypes} data
34+
*/
35+
2736
export default function CreateCrewForm({
2837
type,
2938
isEdit,
@@ -199,7 +208,7 @@ export default function CreateCrewForm({
199208
field.onChange(value);
200209
handleMainCategoryChange(value);
201210
}}
202-
error={errors.mainCategory?.message}
211+
errorMsg={errors.mainCategory?.message}
203212
/>
204213
)}
205214
/>
@@ -218,7 +227,7 @@ export default function CreateCrewForm({
218227
placeholder={isEdit && field.value ? field.value : '세부 카테고리'}
219228
data={categoryData[categoryIndex]?.items || []}
220229
className="flex-1"
221-
error={errors.subCategory?.message}
230+
errorMsg={errors.subCategory?.message}
222231
/>
223232
)}
224233
/>
@@ -277,7 +286,7 @@ export default function CreateCrewForm({
277286
field.onChange(value);
278287
handleMainLocationChange(value);
279288
}}
280-
error={errors.mainLocation?.message}
289+
errorMsg={errors.mainLocation?.message}
281290
/>
282291
)}
283292
/>
@@ -297,7 +306,7 @@ export default function CreateCrewForm({
297306
placeholder={isEdit && field.value ? field.value : '시/군/구'}
298307
data={regionData[regionIndex]?.areas || []}
299308
className="flex-1"
300-
error={errors.subLocation?.message}
309+
errorMsg={errors.subLocation?.message}
301310
/>
302311
)}
303312
/>

src/app/(crew)/crew/detail/[id]/_components/create-gathering/create-gathering-form/index.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ export interface CreateGatheringFormProps {
2020
onClose: () => void;
2121
}
2222

23+
/**
24+
* 약속 생성/수정 폼
25+
* @param {CreateGatheringFormTypes} data
26+
* @param {boolean} isEdit
27+
* @param {(data: CreateGatheringFormTypes) => void} onEdit
28+
* @param {(data: CreateGatheringFormTypes) => void} onSubmit
29+
* @param {() => void} onClose
30+
*/
31+
2332
export default function CreateGatheringForm({
2433
isEdit = false,
2534
onEdit = () => {},

src/app/(crew)/crew/detail/[id]/_components/crew-review-list.stories.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ const meta: Meta<typeof CrewReviewList> = {
1010
component: CrewReviewList,
1111
parameters: {
1212
layout: 'fulled',
13-
nextjs: {
14-
appDirectory: true,
15-
},
1613
},
1714
tags: ['autodocs'],
1815
decorators: [

src/components/common/crew-list/crew-card-list.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ export default function CrewCardList({ data, inWhere }: CrewCardListProps) {
2727

2828
if (!crewDataList.length)
2929
return (
30-
<div className="flex justify-center py-10">
31-
<p>데이터가 없습니다.</p>
32-
</div>
30+
<section className="py-16 text-center">
31+
<h3 className="text-xl font-bold text-blue-500">크루가 아직 없어요</h3>
32+
<p className="mt-4 text-gray-600">크루를 만들어서 함께 운동할 사람을 모집해보세요! 🙌</p>
33+
</section>
3334
);
3435

3536
return (

src/components/common/input/calendar-filter/calendar-filter.stories.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ import type { Meta, StoryFn } from '@storybook/react';
44
import { userEvent, within } from '@storybook/test';
55
import CalendarFilter, { CalendarFilterProps } from '.';
66

7-
const mockData = [
8-
new Date('2024-10-01'),
9-
new Date('2024-10-05'),
10-
new Date('2024-10-12'),
11-
new Date('2024-10-15'),
12-
];
7+
const mockData = [new Date()];
138

149
const meta: Meta = {
1510
title: 'common/calendar/calendar-filter',
@@ -20,7 +15,14 @@ const meta: Meta = {
2015
type: { name: 'string' },
2116
description: '선택된 날짜',
2217
},
23-
toDoDates: mockData,
18+
toDoDates: {
19+
description: '일정이 있는 날짜',
20+
table: {
21+
type: {
22+
summary: 'Date[] | null',
23+
},
24+
},
25+
},
2426
onChange: action('onChange'),
2527
},
2628
parameters: {

src/components/common/input/calendar-filter/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ export interface CalendarFilterProps {
1212
onChange: (date: Date) => void;
1313
}
1414

15+
/**
16+
* 달력에서 날짜를 선택하면 값을 변경할 수 있는 컴포넌트
17+
* @param {Date} value - 선택된 날짜
18+
* @param {Date[] | null} toDoDates - 일정이 있는 날짜
19+
* @param {(date: Date) => void} onChange - 값이 변경될 때 실행하는 함수
20+
*/
21+
1522
export default function CalendarFilter({
1623
value,
1724
toDoDates,

src/components/common/input/date-time-picker/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ export interface DateTimePickerProps {
1212
onChange: (date: string) => void;
1313
}
1414

15+
/**
16+
* 달력에서 날짜를 선택하고, 드롭다운으로 시간을 선택하면 날짜/시간 값을 변경할 수 있는 컴포넌트
17+
* @param {Date} fullDate - 선택된 날짜
18+
* @param {(date: string) => void} onChange - 값이 변경될 때 실행하는 함수
19+
*/
20+
1521
export default function DateTimePicker({ fullDate, onChange }: DateTimePickerProps) {
1622
const [selected, setSelected] = useState<Date>(fullDate || new Date());
1723
const [hour, setHour] = useState<string | null>('시');

0 commit comments

Comments
 (0)