parent
28d408ace5
commit
d9ea716089
1 changed files with 7 additions and 9 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
||||||
import { isMobileOnly } from 'react-device-detect';
|
import { BrowserView, MobileView } from 'react-device-detect';
|
||||||
|
|
||||||
// 공통 컴포넌트
|
// 공통 컴포넌트
|
||||||
import { ScrollToTop } from '@/components/common';
|
import { ScrollToTop } from '@/components/common';
|
||||||
|
|
@ -52,16 +52,14 @@ function PCWrapper({ children }) {
|
||||||
/**
|
/**
|
||||||
* 프로미스나인 팬사이트 메인 앱
|
* 프로미스나인 팬사이트 메인 앱
|
||||||
* react-device-detect를 사용한 PC/Mobile 분리
|
* react-device-detect를 사용한 PC/Mobile 분리
|
||||||
* - PC, 태블릿: PC 뷰
|
|
||||||
* - 모바일(폰): Mobile 뷰
|
|
||||||
*/
|
*/
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<BrowserRouter future={{ v7_startTransition: true, v7_relativeSplatPath: true }}>
|
<BrowserRouter future={{ v7_startTransition: true, v7_relativeSplatPath: true }}>
|
||||||
<ScrollToTop />
|
<ScrollToTop />
|
||||||
|
|
||||||
{/* PC + 태블릿 뷰 */}
|
{/* PC 뷰 */}
|
||||||
{!isMobileOnly && (
|
<BrowserView>
|
||||||
<PCWrapper>
|
<PCWrapper>
|
||||||
<Routes>
|
<Routes>
|
||||||
{/* 관리자 페이지 (레이아웃 없음) */}
|
{/* 관리자 페이지 (레이아웃 없음) */}
|
||||||
|
|
@ -90,10 +88,10 @@ function App() {
|
||||||
/>
|
/>
|
||||||
</Routes>
|
</Routes>
|
||||||
</PCWrapper>
|
</PCWrapper>
|
||||||
)}
|
</BrowserView>
|
||||||
|
|
||||||
{/* Mobile 뷰 (폰만) */}
|
{/* Mobile 뷰 */}
|
||||||
{isMobileOnly && (
|
<MobileView>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route
|
<Route
|
||||||
path="/"
|
path="/"
|
||||||
|
|
@ -156,7 +154,7 @@ function App() {
|
||||||
{/* 404 페이지 */}
|
{/* 404 페이지 */}
|
||||||
<Route path="*" element={<MobileNotFound />} />
|
<Route path="*" element={<MobileNotFound />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
)}
|
</MobileView>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue