Skip to content

Commit

Permalink
๐Ÿš‘๏ธ Add reset isPortraitAtom in Tool component
Browse files Browse the repository at this point in the history
atom ์„ ์–ธ๊ณผ defaultValue ๊ฐ„๊ฒฉ์„ ๋ฉ”๊พธ๊ธฐ์œ„ํ•œ Tool์ปดํฌ๋„ŒํŠธ์—์„œ์˜ ์ดˆ๊ธฐํ™”๋กœ์ง ์ถ”๊ฐ€
  • Loading branch information
GleamingStar committed Mar 28, 2022
1 parent 0376a81 commit 606d284
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/client/components/game/paint/tool/Tool.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import styled from 'styled-components';
import { useRecoilValue, useSetRecoilState } from 'recoil';
import { useEffect } from 'react';
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
import { BsArrowCounterclockwise, BsEraser, BsPencil } from 'react-icons/bs';
import { isPainterSelector } from 'client/atom/gameAtom';
import { toolAtom } from 'client/atom/canvasAtom';
Expand Down Expand Up @@ -59,7 +60,11 @@ const IconWrapper = styled.div`
const Tool = () => {
const setTool = useSetRecoilState(toolAtom);
const isPainter = useRecoilValue(isPainterSelector);
const isPortrait = useRecoilValue(isPortraitAtom);
const [isPortrait, setPortrait] = useRecoilState(isPortraitAtom);

useEffect(() => {
setPortrait(window.innerWidth < 800);
}, []);

const tool = (
<>
Expand Down

0 comments on commit 606d284

Please sign in to comment.