From 2f2de80dc5bbbd19496d2f27c3c2323b9f40784e Mon Sep 17 00:00:00 2001 From: ktmihs Date: Mon, 28 Nov 2022 15:14:38 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20#85=20=EB=88=88=20=EB=82=B4=EB=A6=AC?= =?UTF-8?q?=EA=B8=B0=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 전역으로 상태 관리하여 버튼 토클에 따라 눈내리기 설정 및 해제 --- frontend/src/page/Town/index.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/src/page/Town/index.tsx b/frontend/src/page/Town/index.tsx index 72adb80..525f4da 100644 --- a/frontend/src/page/Town/index.tsx +++ b/frontend/src/page/Town/index.tsx @@ -1,16 +1,19 @@ import { useEffect, useState } from 'react'; +import { useRecoilState, useRecoilValue } from 'recoil'; import Game from '../../component/Game'; import Loading from '../../component/Loading'; import Sidebar from '../../component/Sidebar'; import SleepyBoard from '../../component/SleepyBoard'; import Snow from '../../component/Snow'; +import { snowState } from '../../store/atom/backgroundSetting'; +import { devicePermissionState } from '../../store/atom/deviceSetting'; const Town = () => { const [isLoadingComplete, setIsLoadingComplete] = useState(false); const [isClose, setIsClose] = useState(false); - // 전역으로 관리할 예정 (이후 props drilling 제거) - const [permission, setPermission] = useState(false); + const [permission, setPermission] = useRecoilState(devicePermissionState); + const isSnowing = useRecoilValue(snowState); useEffect(() => { const getDevicePermission = async () => { @@ -30,9 +33,9 @@ const Town = () => { return ( <> - + - + {isSnowing && } {isLoadingComplete || }