diff --git a/src/components/workdetail/leftcomponent/LeftContent.jsx b/src/components/workdetail/leftcomponent/LeftContent.jsx index b435db6..8894bd5 100644 --- a/src/components/workdetail/leftcomponent/LeftContent.jsx +++ b/src/components/workdetail/leftcomponent/LeftContent.jsx @@ -1,9 +1,18 @@ +import { useEffect, useRef } from 'react'; import * as L from './LeftContent.style'; import Image from '../image/Image'; + export default function LeftContent({ images }) { - console.log(images); + const containerRef = useRef(null); + + useEffect(() => { + if (containerRef.current) { + containerRef.current.scrollTop = 0; + } + }, [images]); + return ( - + {images.map((item, index) => ( ))} diff --git a/src/components/workdetail/rightcomponent/RightContent.jsx b/src/components/workdetail/rightcomponent/RightContent.jsx index 05911ec..58fd200 100644 --- a/src/components/workdetail/rightcomponent/RightContent.jsx +++ b/src/components/workdetail/rightcomponent/RightContent.jsx @@ -1,3 +1,4 @@ +import { useEffect, useRef } from 'react'; import * as R from './RightContent.style'; import viewSiteImage from '../../../assets/img/viewsite_black.png'; import WorkTitle from '../worktitle/WorkTitle'; @@ -8,9 +9,16 @@ import ViewSite from '../button/ViewSite'; export default function RightContent({ data }) { - console.log(data); + const containerRef = useRef(null); + + useEffect(() => { + if (containerRef.current) { + containerRef.current.scrollTop = 0; + } + }, [data]); + return ( - +