-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
100 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { SubmitHandler } from 'react-hook-form'; | ||
import ModalLayout from '@layouts/ModalLayout'; | ||
import ModalPortal from '@components/modal/ModalPortal'; | ||
import ModalTaskForm from '@components/modal/task/ModalTaskForm'; | ||
import ModaFormButton from '@components/modal/ModaFormButton'; | ||
import { TaskForm } from '@/types/TaskType'; | ||
|
||
type CreateModalTaskProps = { | ||
onClose: () => void; | ||
}; | ||
|
||
export default function CreateModalTask({ onClose: handleClose }: CreateModalTaskProps) { | ||
// ToDo: 상태 생성을 위한 네트워크 로직 추가 | ||
const handleSubmit: SubmitHandler<TaskForm> = async (data) => { | ||
console.log('생성 폼 제출'); | ||
console.log(data); | ||
handleClose(); | ||
}; | ||
return ( | ||
<ModalPortal> | ||
<ModalLayout onClose={handleClose}> | ||
<div className="flex h-full flex-col items-center justify-center"> | ||
{/* ToDo: Task 생성 모달 작성시 수정할 것 */} | ||
<ModalTaskForm formId="updateTaskForm" onSubmit={handleSubmit} /> | ||
<ModaFormButton formId="updateTaskForm" isCreate={false} onClose={handleClose} /> | ||
</div> | ||
</ModalLayout> | ||
</ModalPortal> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { SubmitHandler, useForm } from 'react-hook-form'; | ||
import { Task, TaskForm } from '@/types/TaskType'; | ||
|
||
type ModalTaskFromProps = { | ||
formId: string; | ||
taskId?: Task['taskId']; | ||
onSubmit: SubmitHandler<TaskForm>; | ||
}; | ||
|
||
// ToDo: Task 모달 작성시 Task Form 만들기 | ||
export default function ModalTaskForm({ formId, taskId, onSubmit }: ModalTaskFromProps) { | ||
const { register, handleSubmit } = useForm<TaskForm>({ | ||
mode: 'onChange', | ||
defaultValues: {}, | ||
}); | ||
return ( | ||
<form id={formId} className="mb-10 flex grow flex-col justify-center" onSubmit={handleSubmit(onSubmit)}> | ||
<div>{taskId}</div> | ||
</form> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { SubmitHandler } from 'react-hook-form'; | ||
import ModalLayout from '@layouts/ModalLayout'; | ||
import ModalPortal from '@components/modal/ModalPortal'; | ||
import ModalTaskForm from '@components/modal/task/ModalTaskForm'; | ||
import ModaFormButton from '@components/modal/ModaFormButton'; | ||
import { Task, TaskForm } from '@/types/TaskType'; | ||
|
||
type UpdateModalTaskProps = { | ||
taskId: Task['taskId']; | ||
onClose: () => void; | ||
}; | ||
|
||
export default function UpdateModalTask({ taskId, onClose: handleClose }: UpdateModalTaskProps) { | ||
// ToDo: 상태 생성을 위한 네트워크 로직 추가 | ||
const handleSubmit: SubmitHandler<TaskForm> = async (data) => { | ||
console.log('생성 폼 제출'); | ||
console.log(data); | ||
handleClose(); | ||
}; | ||
return ( | ||
<ModalPortal> | ||
<ModalLayout onClose={handleClose}> | ||
<div className="flex h-full flex-col items-center justify-center"> | ||
{/* ToDo: Task 수정 모달 작성시 수정할 것 */} | ||
<ModalTaskForm formId="updateTaskForm" taskId={taskId} onSubmit={handleSubmit} /> | ||
<ModaFormButton formId="updateTaskForm" isCreate={false} onClose={handleClose} /> | ||
</div> | ||
</ModalLayout> | ||
</ModalPortal> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters