initial App/Nav setup

This commit is contained in:
TaylorS15 2023-02-10 16:20:47 -05:00
parent 3aed55ba60
commit e1e9daf1d1
3 changed files with 48 additions and 5 deletions

View File

@ -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;

View File

@ -0,0 +1,3 @@
export default function DocsGPT() {
return <div>Docs GPT</div>;
}

View 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 />;
}
}