From b096c4bb3d7293b467e930ffcf8a4529f81fa15d Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Mon, 15 Jan 2024 04:44:22 +0900 Subject: [PATCH 01/19] =?UTF-8?q?chore:=20=EB=B3=80=EC=88=98=EC=84=A0?= =?UTF-8?q?=EC=96=B8=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/LecueNote/components/CreateNote/index.tsx | 40 ++++-------------- src/LecueNote/page/LeceuNotePage/index.tsx | 41 ++++++++++++++++++- src/LecueNote/type/lecueNoteType.ts | 12 ++++++ 3 files changed, 58 insertions(+), 35 deletions(-) diff --git a/src/LecueNote/components/CreateNote/index.tsx b/src/LecueNote/components/CreateNote/index.tsx index 67c5591c..e5fe073f 100644 --- a/src/LecueNote/components/CreateNote/index.tsx +++ b/src/LecueNote/components/CreateNote/index.tsx @@ -1,47 +1,21 @@ -import { useState } from 'react'; - -import { - BG_COLOR_CHART, - CATEGORY, - TEXT_COLOR_CHART, -} from '../../constants/colorChart'; import { CreateNoteProps } from '../../type/lecueNoteType'; import SelectColor from '../SelectColor'; import WriteNote from '../WriteNote'; import * as S from './CreateNote.style'; function CreateNote({ + clickedCategory, + clickedBgColor, + clickedTextColor, + isIconClicked, contents, handleChangeFn, + handleClickCategory, + handleClickedColorBtn, + handleClickedIcon, imgFile, uploadImage, }: CreateNoteProps) { - const [clickedCategory, setclickedCategory] = useState(CATEGORY[0]); - const [clickedTextColor, setClickedTextColor] = useState(TEXT_COLOR_CHART[0]); - const [clickedBgColor, setclickedBgColor] = useState(BG_COLOR_CHART[0]); - const [isIconClicked, setIsIconClicked] = useState(false); - - const handleClickCategory = ( - e: React.MouseEvent, - ) => { - setclickedCategory(e.currentTarget.innerHTML); - }; - - const handleClickedColorBtn = ( - e: React.MouseEvent, - ) => { - if (clickedCategory === '텍스트색') { - setClickedTextColor(e.currentTarget.id); - } else { - setclickedBgColor(e.currentTarget.id); - setIsIconClicked(false); - } - }; - - const handleClickedIcon = () => { - setIsIconClicked(true); - }; - return ( , + ) => { + setclickedCategory(e.currentTarget.innerHTML); + }; const handleChangeContents = (e: React.ChangeEvent) => { setContents(e.target.value); @@ -18,16 +33,38 @@ function LecueNotePage() { } }; + const handleClickedColorBtn = ( + e: React.MouseEvent, + ) => { + if (clickedCategory === '텍스트색') { + setClickedTextColor(e.currentTarget.id); + } else { + setclickedBgColor(e.currentTarget.id); + setIsIconClicked(false); + } + }; + + const handleClickedIcon = () => { + setIsIconClicked(true); + }; + return (
setImgFile(file)} + handleChangeFn={handleChangeContents} + handleClickCategory={handleClickCategory} + handleClickedColorBtn={handleClickedColorBtn} + handleClickedIcon={handleClickedIcon} /> -