Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/app/(crew)/_components/hero/hero-crew.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function HeroCrew() {
<strong className="text-sm font-medium text-gray-700 md:text-base">
함께할 사람이 없나요?
</strong>
<strong className="text-2xl font-semibold text-gray-900 md:text-3.5xl">
<strong className="text-xl font-semibold text-gray-900 md:text-3xl">
지금 크루에 참여해보세요.
</strong>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,27 @@ export default {
title: 'crew/create-crew-form',
component: CreateCrewForm,
tags: ['autodocs'],
argTypes: {
type: {
control: 'radio',
options: ['create', 'edit'],
description: '폼 타입',
table: { type: { summary: 'create | edit' } },
},
data: {
control: 'object',
description: '폼 데이터',
table: { type: { summary: 'CreateCrewFormTypes' } },
},
isEdit: { control: 'boolean', description: '수정 여부' },
onSubmit: {
action: 'submit',
table: { type: { summary: '(data: CreateCrewFormTypes) => void' } },
},
onEdit: { action: 'edit', table: { type: { summary: '(data: CreateCrewFormTypes) => void' } } },
},
parameters: {
layout: 'fullscreen',
nextjs: {
appDirectory: true,
},
docs: {
description: {
component: '크루 작성/수정에 사용되는 폼입니다.',
Expand Down
21 changes: 15 additions & 6 deletions src/app/(crew)/crew/create/_components/create-crew-form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,26 @@ import DropDown from '@/src/components/common/input/drop-down';
import FileInputWrap from '@/src/components/common/input/file-input-wrap';
import TextInput from '@/src/components/common/input/text-input';
import Textarea from '@/src/components/common/input/textarea';
import { CreateCrewFormTypes, EditCrewResponseTypes } from '@/src/types/create-crew';
import { CreateCrewFormTypes } from '@/src/types/create-crew';
import ImgCrewSampleUrls from '@/public/assets/images/crew-sample';

export interface CreateCrewFormProps {
type: 'create' | 'edit';
data: CreateCrewFormTypes | EditCrewResponseTypes;
data: CreateCrewFormTypes;
isEdit?: boolean;
onEdit?: (data: CreateCrewFormTypes) => void;
onSubmit?: (data: CreateCrewFormTypes) => void;
}

/**
* 크루 생성/수정 폼
* @param {'create' | 'edit'} type : form 타입
* @param {boolean} isEdit : 수정 여부
* @param {(data: CreateCrewFormTypes) => void} onEdit
* @param {(data: CreateCrewFormTypes) => void} onSubmit
* @param {CreateCrewFormTypes} data
*/

export default function CreateCrewForm({
type,
isEdit,
Expand Down Expand Up @@ -199,7 +208,7 @@ export default function CreateCrewForm({
field.onChange(value);
handleMainCategoryChange(value);
}}
error={errors.mainCategory?.message}
errorMsg={errors.mainCategory?.message}
/>
)}
/>
Expand All @@ -218,7 +227,7 @@ export default function CreateCrewForm({
placeholder={isEdit && field.value ? field.value : '세부 카테고리'}
data={categoryData[categoryIndex]?.items || []}
className="flex-1"
error={errors.subCategory?.message}
errorMsg={errors.subCategory?.message}
/>
)}
/>
Expand Down Expand Up @@ -277,7 +286,7 @@ export default function CreateCrewForm({
field.onChange(value);
handleMainLocationChange(value);
}}
error={errors.mainLocation?.message}
errorMsg={errors.mainLocation?.message}
/>
)}
/>
Expand All @@ -297,7 +306,7 @@ export default function CreateCrewForm({
placeholder={isEdit && field.value ? field.value : '시/군/구'}
data={regionData[regionIndex]?.areas || []}
className="flex-1"
error={errors.subLocation?.message}
errorMsg={errors.subLocation?.message}
/>
)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ export interface CreateGatheringFormProps {
onClose: () => void;
}

/**
* 약속 생성/수정 폼
* @param {CreateGatheringFormTypes} data
* @param {boolean} isEdit
* @param {(data: CreateGatheringFormTypes) => void} onEdit
* @param {(data: CreateGatheringFormTypes) => void} onSubmit
* @param {() => void} onClose
*/

export default function CreateGatheringForm({
isEdit = false,
onEdit = () => {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ const meta: Meta<typeof CrewReviewList> = {
component: CrewReviewList,
parameters: {
layout: 'fulled',
nextjs: {
appDirectory: true,
},
},
tags: ['autodocs'],
decorators: [
Expand Down
7 changes: 4 additions & 3 deletions src/components/common/crew-list/crew-card-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ export default function CrewCardList({ data, inWhere }: CrewCardListProps) {

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

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ import type { Meta, StoryFn } from '@storybook/react';
import { userEvent, within } from '@storybook/test';
import CalendarFilter, { CalendarFilterProps } from '.';

const mockData = [
new Date('2024-10-01'),
new Date('2024-10-05'),
new Date('2024-10-12'),
new Date('2024-10-15'),
];
const mockData = [new Date()];

const meta: Meta = {
title: 'common/calendar/calendar-filter',
Expand All @@ -20,7 +15,14 @@ const meta: Meta = {
type: { name: 'string' },
description: '선택된 날짜',
},
toDoDates: mockData,
toDoDates: {
description: '일정이 있는 날짜',
table: {
type: {
summary: 'Date[] | null',
},
},
},
onChange: action('onChange'),
},
parameters: {
Expand Down
7 changes: 7 additions & 0 deletions src/components/common/input/calendar-filter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ export interface CalendarFilterProps {
onChange: (date: Date) => void;
}

/**
* 달력에서 날짜를 선택하면 값을 변경할 수 있는 컴포넌트
* @param {Date} value - 선택된 날짜
* @param {Date[] | null} toDoDates - 일정이 있는 날짜
* @param {(date: Date) => void} onChange - 값이 변경될 때 실행하는 함수
*/

export default function CalendarFilter({
value,
toDoDates,
Expand Down
6 changes: 6 additions & 0 deletions src/components/common/input/date-time-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ export interface DateTimePickerProps {
onChange: (date: string) => void;
}

/**
* 달력에서 날짜를 선택하고, 드롭다운으로 시간을 선택하면 날짜/시간 값을 변경할 수 있는 컴포넌트
* @param {Date} fullDate - 선택된 날짜
* @param {(date: string) => void} onChange - 값이 변경될 때 실행하는 함수
*/

export default function DateTimePicker({ fullDate, onChange }: DateTimePickerProps) {
const [selected, setSelected] = useState<Date>(fullDate || new Date());
const [hour, setHour] = useState<string | null>('시');
Expand Down
41 changes: 38 additions & 3 deletions src/components/common/input/drop-down/drop-down.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,57 @@ const meta: Meta = {
},
value: {
description: '선택된 값',
table: {
type: {
summary: 'string | null',
},
},
},
data: {
description: '옵션 데이터 배열',
},
variant: {
description: '`default` | `sort`',
description: '컴포넌트 타입',
control: {
type: 'radio',
option: ['default', 'sort'],
},
table: {
type: {
summary: 'default | sort',
},
},
},
placeholder: {
description: '선택된 값이 없을 때 표시하는 문자열',
},
onChange: {
description: '값이 변경될 때 실행하는 함수',
onChange: action('onChange'),
errorMsg: {
description: '에러 메시지',
table: {
type: {
summary: 'string | null',
},
},
},
inWhere: {
description: '컴포넌트 사용 위치',
control: {
type: 'radio',
option: ['default', 'form'],
},
table: {
type: {
summary: 'default | form',
},
},
},
},
parameters: {
docs: {
description: {
component: '필터/정렬에 사용되는 드롭다운입니다.',
},
},
},
};
Expand Down
Loading
Loading