mirror of
https://github.com/arc53/DocsGPT
synced 2024-11-03 23:15:37 +00:00
initial App/Nav setup
This commit is contained in:
parent
3aed55ba60
commit
e1e9daf1d1
@ -1,11 +1,34 @@
|
||||
import './App.css'
|
||||
import { useEffect, useState } from 'react';
|
||||
import Navigation from './components/Navigation';
|
||||
import DocsGPT from './components/DocsGPT';
|
||||
import './App.css';
|
||||
|
||||
function App() {
|
||||
const [isMobile, setIsMobile] = useState(true);
|
||||
|
||||
const handleResize = () => {
|
||||
if (window.innerWidth > 768 && isMobile) {
|
||||
setIsMobile(false);
|
||||
} else {
|
||||
setIsMobile(true);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener('resize', handleResize);
|
||||
handleResize();
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('resize', handleResize);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="flex justify-center h-screen items-center">
|
||||
<p className="text-6xl">DocsGPT 🦖</p>
|
||||
<div className={`${isMobile ? 'flex-col' : 'flex-row'} flex`}>
|
||||
<Navigation isMobile={isMobile} />
|
||||
<DocsGPT />
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default App
|
||||
export default App;
|
||||
|
3
frontend/src/components/DocsGPT.tsx
Normal file
3
frontend/src/components/DocsGPT.tsx
Normal file
@ -0,0 +1,3 @@
|
||||
export default function DocsGPT() {
|
||||
return <div>Docs GPT</div>;
|
||||
}
|
17
frontend/src/components/Navigation.tsx
Normal file
17
frontend/src/components/Navigation.tsx
Normal file
@ -0,0 +1,17 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
function MobileNavigation() {
|
||||
return <div>Mobile Navigation</div>;
|
||||
}
|
||||
|
||||
function DesktopNavigation() {
|
||||
return <div>Desktop Navigation</div>;
|
||||
}
|
||||
|
||||
export default function Navigation({ isMobile }: { isMobile: boolean }) {
|
||||
if (isMobile) {
|
||||
return <MobileNavigation />;
|
||||
} else {
|
||||
return <DesktopNavigation />;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user