Skip to content

Commit 584d026

Browse files
authored
Merge pull request #149 from imaginer-dev/29-그룹-일정과-관련된-데이터를-수정할-수-있어야한다
29 그룹 일정과 관련된 데이터를 수정할 수 있어야한다
2 parents 9f30946 + b057fe4 commit 584d026

21 files changed

+354
-21
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { FC } from 'react';
2+
import GroupFormNameInput from './GroupFormNameInput';
3+
import GroupFormDescriptionInput from './GroupFormDescriptionInput';
4+
import GroupFormDateInput from './GroupFormDateInput';
5+
import UserInvite from '../common/UserInvite';
6+
import GroupFormMemoInput from './GroupFormMemoInput';
7+
8+
interface Props {
9+
name?: string;
10+
description?: string;
11+
startDate?: string;
12+
endDate?: string;
13+
memo?: string;
14+
onSubmit: React.FormEventHandler<HTMLFormElement>;
15+
}
16+
17+
const GroupForm: FC<Props> = ({
18+
name = '',
19+
description = '',
20+
startDate = new Date().toString(),
21+
endDate = new Date().toString(),
22+
memo = '',
23+
onSubmit,
24+
}) => {
25+
return (
26+
<form onSubmit={onSubmit} className="container mx-auto flex max-w-sm flex-1 flex-col gap-4 pb-[50px] pt-4">
27+
<div className="flex h-full w-full flex-1 flex-col gap-4">
28+
<GroupFormNameInput name={name} />
29+
<GroupFormDescriptionInput description={description} />
30+
<GroupFormDateInput startDate={startDate} endDate={endDate} />
31+
<UserInvite />
32+
<GroupFormMemoInput memo={memo} />
33+
</div>
34+
<button type="submit" className="btn btn-outline btn-primary w-full">
35+
저장
36+
</button>
37+
</form>
38+
);
39+
};
40+
41+
export default GroupForm;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { FC } from 'react';
2+
import { dateToYYMMDD } from '@/utils/dateUtils';
3+
4+
interface Props {
5+
startDate: string;
6+
endDate: string;
7+
}
8+
9+
const GroupFormDateInput: FC<Props> = ({ startDate, endDate }) => {
10+
return (
11+
<div className="w-full">
12+
<label className="label label-text w-full text-start">모임 설정 기간 *</label>
13+
<div className="input input-bordered flex w-full flex-row items-center gap-1 p-0">
14+
<label className="hidden" htmlFor="group-start-date-input">
15+
모임 시작
16+
</label>
17+
<input
18+
className="input border-none"
19+
type="date"
20+
defaultValue={dateToYYMMDD(new Date(startDate))}
21+
id="group-start-date-input"
22+
name="startDate"
23+
/>
24+
~
25+
<label className="hidden" htmlFor="group-end-date-input">
26+
모임 종료
27+
</label>
28+
<input
29+
className="input border-none"
30+
type="date"
31+
id="group-end-date-input"
32+
defaultValue={dateToYYMMDD(new Date(endDate))}
33+
name="endDate"
34+
/>
35+
</div>
36+
</div>
37+
);
38+
};
39+
40+
export default GroupFormDateInput;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { FC } from 'react';
2+
import InputForm from '../common/InputForm';
3+
4+
interface Props {
5+
description: string;
6+
}
7+
8+
const GroupFormDescriptionInput: FC<Props> = ({ description }) => {
9+
return (
10+
<InputForm
11+
id="group-description-input"
12+
type="text"
13+
defaultValue={description}
14+
placeholder="모임 설명을 입력하세요"
15+
onChange={() => {}}
16+
title="모임 설명"
17+
hint=""
18+
name="description"
19+
/>
20+
);
21+
};
22+
23+
export default GroupFormDescriptionInput;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { FC } from 'react';
2+
3+
interface Props {
4+
memo: string;
5+
}
6+
7+
const GroupFormMemoInput: FC<Props> = ({ memo }) => {
8+
return (
9+
<div>
10+
<label className="label label-text w-full text-start">메모</label>
11+
<textarea
12+
id="group-memo-input"
13+
className="input input-bordered h-24 w-full"
14+
rows={10}
15+
placeholder="메모를 입력하세요"
16+
defaultValue={memo}
17+
onChange={() => {}}
18+
title="메모"
19+
name="memo"
20+
/>
21+
<p className="label-text-alt">최대 500자 까지 입력할 수 있습니다.</p>
22+
</div>
23+
);
24+
};
25+
26+
export default GroupFormMemoInput;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { FC } from 'react';
2+
import InputForm from '../common/InputForm';
3+
4+
interface Props {
5+
name: string;
6+
}
7+
8+
const GroupFormNameInput: FC<Props> = ({ name = '' }) => {
9+
return (
10+
<InputForm
11+
id="group-name-input"
12+
type="text"
13+
defaultValue={name}
14+
placeholder="모임명을 입력하세요"
15+
onChange={() => {}}
16+
title="모임명 *"
17+
hint=""
18+
name="name"
19+
/>
20+
);
21+
};
22+
23+
export default GroupFormNameInput;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Meta, StoryObj } from '@storybook/react';
2+
import AppBar from './AppBar';
3+
import { BrowserRouter } from 'react-router-dom';
4+
5+
const meta: Meta<typeof AppBar> = {
6+
title: 'AppBar',
7+
component: AppBar,
8+
render: (args) => (
9+
<BrowserRouter>
10+
<AppBar {...args} />
11+
</BrowserRouter>
12+
),
13+
};
14+
15+
export default meta;
16+
17+
export type story = StoryObj<typeof AppBar>;
18+
19+
export const Default: story = {
20+
args: {
21+
title: '모임 일정 등록하기',
22+
backButton: true,
23+
},
24+
};

src/components/common/AppBar.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { FC } from 'react';
2+
import HistoryBackButton from './HistoryBackButton';
3+
4+
interface AppBarProps {
5+
title?: string;
6+
backButton?: boolean;
7+
}
8+
9+
const AppBar: FC<AppBarProps> = ({ title = '', backButton = true }) => {
10+
return (
11+
<nav className="grid grid-cols-5 py-5">
12+
<div className="col-span-1">{backButton ? <HistoryBackButton /> : <span />}</div>
13+
<h1 className="col-span-3 text-center">{title}</h1>
14+
<span className="col-span-1" />
15+
</nav>
16+
);
17+
};
18+
19+
export default AppBar;

src/components/common/DialogButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function DialogButton({ classname, name, title, desc, children }: Props) {
2525

2626
return (
2727
<div>
28-
<button className={classname} onClick={() => openModal(dialogRef)}>
28+
<button type="button" className={classname} onClick={() => openModal(dialogRef)}>
2929
{name}
3030
</button>
3131
<Dialog ref={dialogRef} title={title} desc={desc}>

src/components/common/HistoryBackButton.tsx

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,14 @@ const HistoryBackButton: React.FC = () => {
88
};
99

1010
return (
11-
<div className="mr-auto w-3 md:w-4">
12-
<svg
13-
onClick={handleBack}
14-
className={'shrink-0'}
15-
width="100%"
16-
height="100%"
17-
viewBox="0 0 256 512"
18-
fill="#429400"
19-
preserveAspectRatio="xMinYMin meet"
20-
xmlns="http://www.w3.org/2000/svg"
21-
>
22-
<path d="M9.4 278.6c-12.5-12.5-12.5-32.8 0-45.3l128-128c9.2-9.2 22.9-11.9 34.9-6.9s19.8 16.6 19.8 29.6l0 256c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-128-128z" />
11+
<button type="button" onClick={handleBack}>
12+
<svg width="13" height="16" viewBox="0 0 13 16" fill="none" xmlns="http://www.w3.org/2000/svg">
13+
<path
14+
d="M10.7 15.1595C11.6989 15.7893 13 15.0714 13 13.8907L13 2.10951C13 0.928727 11.6989 0.21091 10.7 0.840621L1.35638 6.73119C0.422984 7.31964 0.422986 8.68052 1.35638 9.26897L10.7 15.1595Z"
15+
fill="#429400"
16+
/>
2317
</svg>
24-
</div>
18+
</button>
2519
);
2620
};
2721

File renamed without changes.

0 commit comments

Comments
 (0)