From 39c2b9cc26a43c90494d993f023af7bff408a332 Mon Sep 17 00:00:00 2001 From: Changhyun-Hong Date: Tue, 3 Dec 2024 18:49:07 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=8D=94=EB=B3=B4=EA=B8=B0=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/main/MainLiveSection.tsx | 14 +++++++++----- .../src/components/main/MainReplaySection.tsx | 16 ++++++++++------ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/main/MainLiveSection.tsx b/frontend/src/components/main/MainLiveSection.tsx index 6f1385e0..ff0f0f2c 100644 --- a/frontend/src/components/main/MainLiveSection.tsx +++ b/frontend/src/components/main/MainLiveSection.tsx @@ -23,10 +23,14 @@ const MainLiveSection = ({ title }: MainLiveSectionProps) => { const updateRenderCount = () => { const width = window.innerWidth; - if (width <= 1095) setRenderCount(4); - else if (width <= 1434) setRenderCount(6); - else if (width <= 1770) setRenderCount(8); - else setRenderCount(10); + if (textStatus === VIDEO_VIEW.FOLD) { + setRenderCount(allData.length); + } else { + if (width <= 1095) setRenderCount(4); + else if (width <= 1434) setRenderCount(6); + else if (width <= 1770) setRenderCount(8); + else setRenderCount(10); + } }; updateRenderCount(); @@ -36,7 +40,7 @@ const MainLiveSection = ({ title }: MainLiveSectionProps) => { return () => { window.removeEventListener('resize', updateRenderCount); }; - }, []); + }, [textStatus]); const handleTextChange = () => { setTextStatus(textStatus === VIDEO_VIEW.MORE_VIEW ? VIDEO_VIEW.FOLD : VIDEO_VIEW.MORE_VIEW); diff --git a/frontend/src/components/main/MainReplaySection.tsx b/frontend/src/components/main/MainReplaySection.tsx index 029a884e..55f71b6a 100644 --- a/frontend/src/components/main/MainReplaySection.tsx +++ b/frontend/src/components/main/MainReplaySection.tsx @@ -23,10 +23,14 @@ const MainReplaySection = ({ title }: MainReplaySectionProps) => { const updateRenderCount = () => { const width = window.innerWidth; - if (width <= 1095) setRenderCount(4); - else if (width <= 1434) setRenderCount(6); - else if (width <= 1770) setRenderCount(8); - else setRenderCount(10); + if (textStatus === VIDEO_VIEW.FOLD) { + setRenderCount(allData.length); + } else { + if (width <= 1095) setRenderCount(4); + else if (width <= 1434) setRenderCount(6); + else if (width <= 1770) setRenderCount(8); + else setRenderCount(10); + } }; updateRenderCount(); @@ -36,7 +40,7 @@ const MainReplaySection = ({ title }: MainReplaySectionProps) => { return () => { window.removeEventListener('resize', updateRenderCount); }; - }, []); + }, [textStatus]); const handleTextChange = () => { setTextStatus(textStatus === VIDEO_VIEW.MORE_VIEW ? VIDEO_VIEW.FOLD : VIDEO_VIEW.MORE_VIEW); @@ -91,4 +95,4 @@ const MainSectionContentList = styled.div<{ $textStatus: string }>` > div { max-width: 100%; } -`; \ No newline at end of file +`;