Skip to content

Commit

Permalink
Merge pull request #287 from boostcampwm-2024/feature/fe/#286-noDesktโ€ฆ
Browse files Browse the repository at this point in the history
โ€ฆopVer

[FE][Feat] #286 : ๋ฐ์Šคํฌํƒ‘ ์ ‘์†์‹œ ๋ชจ๋ฐ”์ผ ์ ‘์† ์œ ๋„
  • Loading branch information
happyhyep authored Nov 27, 2024
2 parents 6fda46b + d52c46c commit f616c77
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
25 changes: 25 additions & 0 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#root {
touch-action: pan-y;
font-family: Pretendard, 'Pretendard Variable', sans-serif;
}

.logo {
Expand Down Expand Up @@ -45,6 +46,30 @@
user-select:none
}

.overlay {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.8);
display: flex;
justify-content: center;
align-items: center;
color: #fff;
z-index: 10000;
}

.message {
text-align: center;
font-size: 1.5rem;
line-height: 3;
display: flex;
flex-direction: column;
span {
line-height: 1.5;
font-size: 0.8rem;

.spinner {
width: 3rem;
height: 3rem;
Expand Down
39 changes: 38 additions & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,41 @@
import { IndexRoutes } from '@/routes/IndexRoutes.tsx';
import 'App.css';
import { useEffect, useState } from 'react';

export const App = () => <IndexRoutes />;
export const App = () => {
const [isMobile, setIsMobile] = useState(true);

useEffect(() => {
const checkIsMobile = () => {
const isMobileScreen = window.innerWidth <= 768;

const userAgent = navigator.userAgent || navigator.vendor || (window as any).opera;
const isMobileDevice = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(
userAgent,
);

setIsMobile(isMobileScreen || isMobileDevice);
};

checkIsMobile();

window.addEventListener('resize', checkIsMobile);

return () => window.removeEventListener('resize', checkIsMobile);
}, []);

if (!isMobile) {
return (
<>
<div className="overlay">
<div className="message">
๋ชจ๋ฐ”์ผ๋กœ ์ ‘์†ํ•ด์ฃผ์„ธ์š”! <span>๋งŽ์€ ๊ด€์‹ฌ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.</span>
<span>๋ฐ์Šคํฌํƒ‘ ๋ฒ„์ „์€ ์ถ”ํ›„ ์—…๋ฐ์ดํŠธ๋  ์˜ˆ์ •์ด๋‹ˆ ์กฐ๊ธˆ๋งŒ ๊ธฐ๋‹ค๋ ค์ฃผ์„ธ์š”!</span>
</div>
</div>
<IndexRoutes />
</>
);
}
return <IndexRoutes />;
};

0 comments on commit f616c77

Please sign in to comment.