From 46821d88f7dfbc3e7edeab61bc65e7fb0bbc05d3 Mon Sep 17 00:00:00 2001 From: Daegyeom Ha Date: Tue, 27 Aug 2024 20:57:27 +0900 Subject: [PATCH 1/4] fix: update `max-width` value in AdminLayout container --- src/layouts/AdminLayout/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/AdminLayout/index.tsx b/src/layouts/AdminLayout/index.tsx index 62e3d1f..9bf832c 100644 --- a/src/layouts/AdminLayout/index.tsx +++ b/src/layouts/AdminLayout/index.tsx @@ -8,7 +8,7 @@ import { Space } from '../../components/Space'; const Container = styled.div` color: ${Colors.PRIMARY}; - max-width: 960px; + max-width: 1200px; margin: 0 auto; @media screen and (max-width: 420px) { From d724ed0630e9da3dbe57428f8d3f3bb19608bd91 Mon Sep 17 00:00:00 2001 From: Daegyeom Ha Date: Tue, 27 Aug 2024 21:00:32 +0900 Subject: [PATCH 2/4] fix: update modal size of UpdateModel --- src/components/Dialogs/UpdateModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Dialogs/UpdateModal.tsx b/src/components/Dialogs/UpdateModal.tsx index a04734a..17eca8c 100644 --- a/src/components/Dialogs/UpdateModal.tsx +++ b/src/components/Dialogs/UpdateModal.tsx @@ -45,7 +45,7 @@ const UpdateModal: React.FC = ({ modalController, fields, defa }, [setValue, fields, defaultValue]); return ( - + 수정하기 From 4bb17f84148f651f85d97032459b3a173137c6f7 Mon Sep 17 00:00:00 2001 From: Daegyeom Ha Date: Fri, 30 Aug 2024 19:35:25 +0900 Subject: [PATCH 3/4] fix: remove Space component * And show this component when`images` object has content. --- src/pages/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 609d7ac..143ce10 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -105,7 +105,7 @@ const Index: React.FC = ({ {/* */} {/* */} - {content.links.length > 0 && } + {/* */} {content.hasMargin && } From 0c9ed1decf61984380bc69703683d642073cf04b Mon Sep 17 00:00:00 2001 From: Daegyeom Ha Date: Fri, 30 Aug 2024 19:47:14 +0900 Subject: [PATCH 4/4] fix: preserve content in UpdateModal component when rerender --- src/components/Dialogs/UpdateModal.tsx | 36 +++++++++++++++++++------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/src/components/Dialogs/UpdateModal.tsx b/src/components/Dialogs/UpdateModal.tsx index 17eca8c..4af04ec 100644 --- a/src/components/Dialogs/UpdateModal.tsx +++ b/src/components/Dialogs/UpdateModal.tsx @@ -1,4 +1,4 @@ -import React, { Fragment, useEffect } from 'react'; +import React, { Fragment, useEffect, useRef } from 'react'; import { Button, ComponentWithAs, @@ -35,17 +35,29 @@ interface UpdateModalProps { const UpdateModal: React.FC = ({ modalController, fields, defaultValue, onUpdateClick }) => { const { isOpen, onClose } = modalController; const { register, handleSubmit, setValue } = useForm>(); + const isFirstOpen = useRef(false); useEffect(() => { - fields - .map(({ id }) => id) - .forEach((i, index) => { - setValue(i, defaultValue[index]); - }); - }, [setValue, fields, defaultValue]); + if (isOpen && !isFirstOpen.current) { + fields + .map(({ id }) => id) + .forEach((i, index) => { + setValue(i, defaultValue[index]); + }); + isFirstOpen.current = true; + } + }, [isFirstOpen, setValue, fields, defaultValue]); return ( - + { + onClose(); + isFirstOpen.current = false; + }} + isCentered + size="2xl" + > 수정하기 @@ -68,7 +80,13 @@ const UpdateModal: React.FC = ({ modalController, fields, defa -