-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
โฆopVer [FE][Feat] #286 : ๋ฐ์คํฌํ ์ ์์ ๋ชจ๋ฐ์ผ ์ ์ ์ ๋
- Loading branch information
Showing
2 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 />; | ||
}; |