From 536d70bb35d73c49f0337fda51ef61a14d64d30c Mon Sep 17 00:00:00 2001 From: Suk Woo Date: Sat, 14 Sep 2024 14:25:21 +0900 Subject: [PATCH] =?UTF-8?q?UI:=20#127=20=EC=9D=BC=EC=A0=95=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20=EC=9E=85=EB=A0=A5=20=EC=96=91=EC=8B=9D=EB=93=A4?= =?UTF-8?q?=EC=9D=84=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=EB=A1=9C=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC=20(#131)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * UI: #127 프로젝트 상태 radio input 컴포넌트 분리 * UI: #127 시작일, 종료일 컴포넌트 분리 * UI: #127 마크다운 컴포넌트 분리 * UI: #127 파일 DropZone 컴포넌트 분리 * UI: #127 마크다운 컴포넌트 props 변경 * UI: #127 시작일, 종료일 컴포넌트 props 변경 * UI: #127 프로젝트 상태 컴포넌트 props 변경 * UI: #127 시작일, 종료일 컴포넌트 props 변경 * UI: #127 마크다운 컴포넌트 props 변경 --- src/components/common/FileDropZone.tsx | 51 ++++ src/components/common/MarkdownEditor.tsx | 37 +++ src/components/common/PeriodDateInput.tsx | 85 ++++++ src/components/common/StatusRadio.tsx | 51 ++++ src/components/modal/task/ModalTaskForm.tsx | 316 +++++++------------- src/types/FileType.tsx | 1 + 6 files changed, 335 insertions(+), 206 deletions(-) create mode 100644 src/components/common/FileDropZone.tsx create mode 100644 src/components/common/MarkdownEditor.tsx create mode 100644 src/components/common/PeriodDateInput.tsx create mode 100644 src/components/common/StatusRadio.tsx create mode 100644 src/types/FileType.tsx diff --git a/src/components/common/FileDropZone.tsx b/src/components/common/FileDropZone.tsx new file mode 100644 index 00000000..709765f2 --- /dev/null +++ b/src/components/common/FileDropZone.tsx @@ -0,0 +1,51 @@ +import { GoPlusCircle } from 'react-icons/go'; +import { IoMdCloseCircle } from 'react-icons/io'; +import type { CustomFile } from '@/types/FileType'; + +type FileDropZoneProps = { + id: string; + label: string; + files: CustomFile[]; + onFileChange: (e: React.ChangeEvent) => void; + onFileDrop: (e: React.DragEvent) => void; + onFileDeleteClick: (fileId: string) => void; +}; + +// ToDo: 파일 업로드 API 작업시 구조 다시 한 번 확인해보기 +export default function FileDropZone({ + id, + label, + files, + onFileChange: handleFileChange, + onFileDrop: handleFileDrop, + onFileDeleteClick: handleFileDeleteClick, +}: FileDropZoneProps) { + return ( + + ); +} diff --git a/src/components/common/MarkdownEditor.tsx b/src/components/common/MarkdownEditor.tsx new file mode 100644 index 00000000..b5f764f1 --- /dev/null +++ b/src/components/common/MarkdownEditor.tsx @@ -0,0 +1,37 @@ +import { useState } from 'react'; +import { useFormContext } from 'react-hook-form'; +import ToggleButton from '@components/common/ToggleButton'; +import CustomMarkdown from '@components/common/CustomMarkdown'; + +type MarkdownEditorProps = { + id: string; + label: string; + contentFieldName: string; +}; + +export default function MarkdownEditor({ id, label, contentFieldName }: MarkdownEditorProps) { + const [preview, setPreview] = useState(false); + const { watch, register } = useFormContext(); + + const handlePreviewToggle = () => setPreview((prev) => !prev); + + return ( +