diff --git a/src/components/Common/Energy/EnergeCostRealtime/index.jsx b/src/components/Common/Energy/EnergeCostRealtime/index.jsx index 6ed66bc..e7344ad 100644 --- a/src/components/Common/Energy/EnergeCostRealtime/index.jsx +++ b/src/components/Common/Energy/EnergeCostRealtime/index.jsx @@ -7,13 +7,23 @@ const EnergyCostRealtime = () => { const [isPage1, setIsPage1] = useState(false); const energyInfo = useSelector((state) => state.energy?.info); - function handleClick() { - setIsPage1((pre) => !pre); - } + // function handleClick() { + // setIsPage1((pre) => !pre); + // } + + useEffect(() => { + const timer = setInterval(() => { + setIsPage1(pre => !pre); + }, 10000); + + return () => { + clearInterval(timer); + } + }, []); return ( <> - - + {/* + */} {isPage1 && (
diff --git a/src/components/Modules/EnergyCostAnalysis/Energy/index.jsx b/src/components/Modules/EnergyCostAnalysis/Energy/index.jsx index 524203c..fd2cb6f 100644 --- a/src/components/Modules/EnergyCostAnalysis/Energy/index.jsx +++ b/src/components/Modules/EnergyCostAnalysis/Energy/index.jsx @@ -8,9 +8,13 @@ function Energy(props) { const energyInfo = useSelector((state) => state.energy?.info); useEffect(() => { - setInterval(() => { + const timer = setInterval(() => { setIsPage1((pre) => !pre); - }, 3000); + }, 10000); + + return () => { + clearInterval(timer); + } }, []); return ( diff --git a/src/components/Modules/EnergyCostAnalysis/Energy/index.module.css b/src/components/Modules/EnergyCostAnalysis/Energy/index.module.css index c5613f8..b5ab979 100644 --- a/src/components/Modules/EnergyCostAnalysis/Energy/index.module.css +++ b/src/components/Modules/EnergyCostAnalysis/Energy/index.module.css @@ -28,5 +28,5 @@ .infoText > span:last-child { color: #00FFF7; - font-size: 28px; + font-size: 24px; }