Skip to content

Commit

Permalink
fix: 모바일 화면 높이 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
corinthionia committed Jun 28, 2023
1 parent 58cacb0 commit 065fd6b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useEffect } from 'react';
import { Route, Routes } from 'react-router-dom';

import AddTime from './pages/addTime/AddTime';
Expand All @@ -9,8 +10,13 @@ import Timer from './pages/roomTimer/RoomTimer';
import Login from './pages/login/Login';
import Result from './pages/result/Result';
import Invite from './pages/invite/Invite';
import { setScreenSize } from './utils/setScreenSize';

function App() {
useEffect(() => {
setScreenSize();
}, []);

return (
<Routes>
<Route path="/" element={<Start />} />
Expand Down
4 changes: 4 additions & 0 deletions src/styles/GlobalStyle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const defaultStyle = css`
font-display: fallback;
}
:root {
--vh: 100%;
}
html,
body {
margin: 0;
Expand Down
6 changes: 6 additions & 0 deletions src/utils/setScreenSize.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const setScreenSize = () => {
document.documentElement.style.setProperty(
'--vh',
`${window.innerHeight * 0.01}px`
);
};

0 comments on commit 065fd6b

Please sign in to comment.