Skip to content

Commit 1892356

Browse files
committed
[Refactor] 사파리 세로스크롤 방지 위해 window inner h 기준 계산 추가, h-screen -> h-[calc(var(--vh)_*_100)] 교체
1 parent 6140049 commit 1892356

File tree

10 files changed

+24
-9
lines changed

10 files changed

+24
-9
lines changed

src/components/Layouts/DashboardLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const DashboardLayout = ({
1616
dashboardId,
1717
}: DashboardLayoutProps) => {
1818
return (
19-
<div className="flex h-screen overflow-hidden">
19+
<div className="flex h-[calc(var(--vh)_*_100)] overflow-hidden">
2020
<SideMenu teamId={TEAM_ID} dashboardList={dashboardList} />
2121
<div className="flex flex-col flex-1">
2222
<HeaderDashboard variant="dashboard" dashboardId={dashboardId} />

src/components/sideMenu/SideMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export default function SideMenu({
6565
return (
6666
<aside
6767
className={clsx(
68-
"z-20 flex flex-col h-screen overflow-y-auto lg:overflow-y-hidden overflow-x-hidden transition-all duration-200",
68+
"z-20 flex flex-col h-[calc(var(--vh)_*_100)] overflow-y-auto lg:overflow-y-hidden overflow-x-hidden transition-all duration-200",
6969
"bg-white border-r border-[var(--color-gray3)] py-5",
7070
isCollapsed
7171
? "w-[67px] items-center px-0"

src/pages/404.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function Custom404() {
1717
}, [router]);
1818

1919
return (
20-
<div className="flex flex-col items-center justify-center text-center h-screen bg-[var(--color-gray5)] gap-2">
20+
<div className="flex flex-col items-center justify-center text-center h-[calc(var(--vh)_*_100)] bg-[var(--color-gray5)] gap-2">
2121
<h1 className="font-24b text-[var(--primary)]">404 Not Found</h1>
2222
<p className="font-16r text-black3">페이지를 찾을 수 없습니다.</p>
2323
<p className="font-16r text-black3">5초 후 홈페이지로 이동합니다.</p>

src/pages/_app.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,21 @@ export default function App({ Component, pageProps }: AppPropsWithLayout) {
4747
initializeUser();
4848
}, []);
4949

50+
// 윈도우 기준 높이 사용
51+
useEffect(() => {
52+
const setVH = () => {
53+
const vh = window.innerHeight * 0.01;
54+
document.documentElement.style.setProperty("--vh", `${vh}px`);
55+
};
56+
57+
setVH();
58+
window.addEventListener("resize", setVH);
59+
60+
return () => {
61+
window.removeEventListener("resize", setVH);
62+
};
63+
}, []);
64+
5065
const router = useRouter();
5166
const pathname = router.pathname;
5267

src/pages/dashboard/[dashboardId]/edit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default function EditDashboard() {
5353
}
5454

5555
return (
56-
<div className="flex h-screen overflow-hidden">
56+
<div className="flex h-[calc(var(--vh)_*_100)] overflow-hidden">
5757
<SideMenu
5858
teamId={TEAM_ID}
5959
dashboardList={dashboardList}

src/pages/dashboard/[dashboardId]/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export default function Dashboard() {
106106
}
107107

108108
return (
109-
<div className="flex h-screen min-h-screen">
109+
<div className="flex h-[calc(var(--vh)_*_100)]">
110110
<SideMenu
111111
teamId={TEAM_ID}
112112
dashboardList={dashboardList}

src/pages/login.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default function LoginPage() {
4444
};
4545

4646
return (
47-
<div className="flex flex-col items-center justify-center h-screen bg-white py-10">
47+
<div className="flex flex-col items-center justify-center h-[calc(var(--vh)_*_100)] bg-white py-10">
4848
<div className="flex flex-col items-center justify-center mb-[30px]">
4949
<Image
5050
src="/svgs/main-logo.svg"

src/pages/mydashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export default function MyDashboardPage() {
138138
}
139139

140140
return (
141-
<div className="flex h-screen overflow-hidden bg-[var(--color-violet5)]">
141+
<div className="flex h-[calc(var(--vh)_*_100)] overflow-hidden bg-[var(--color-violet5)]">
142142
<SideMenu
143143
teamId={TEAM_ID}
144144
dashboardList={dashboardList}

src/pages/mypage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default function MyPage() {
3636
}, [isInitialized, user]);
3737

3838
return (
39-
<div className="flex h-screen overflow-hidden">
39+
<div className="flex h-[calc(var(--vh)_*_100)] overflow-hidden">
4040
<SideMenu
4141
teamId={TEAM_ID}
4242
dashboardList={dashboards}

src/pages/signup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default function SignUpPage() {
5757

5858
return (
5959
<div
60-
className="flex flex-col min-h-screen
60+
className="flex flex-col min-h-[calc(var(--vh)_*_100)]
6161
items-center justify-center
6262
bg-white py-10"
6363
>

0 commit comments

Comments
 (0)