This commit is contained in:
2023-02-23 23:58:16 +01:00
parent 9ac7c710f9
commit a21af7d08b
4 changed files with 50 additions and 12 deletions

View File

@ -5,8 +5,8 @@ import Login from './components/Login';
import Register from './components/Register'; import Register from './components/Register';
import Dog from './components/Dog'; import Dog from './components/Dog';
import Qr from './components/Qr'; import Qr from './components/Qr';
import Header from './components/Header'; import Header2 from './components/Header2';
import Footer from './components/Footer'; import Footer2 from './components/Footer2';
import Impressum from './components/Impressum'; import Impressum from './components/Impressum';
import "bootstrap/dist/css/bootstrap.min.css"; import "bootstrap/dist/css/bootstrap.min.css";
import FileUpload from './components/FileUpload'; import FileUpload from './components/FileUpload';
@ -16,9 +16,18 @@ import {getUser} from './services/PhpApi'
import { TUser } from './context/UserContext'; import { TUser } from './context/UserContext';
import PasswordReset from './components/PasswordReset'; import PasswordReset from './components/PasswordReset';
import WantNewPw from './components/WantNewPw'; import WantNewPw from './components/WantNewPw';
import { MantineProvider } from '@mantine/core'; import
{
MantineProvider,
AppShell,
Navbar,
Header,
Aside,
Footer
} from '@mantine/core';
import { NotificationsProvider } from '@mantine/notifications'; import { NotificationsProvider } from '@mantine/notifications';
import { notificationError } from './services/Notifications'; import { notificationError } from './services/Notifications';
import DogNavbar from './components/DogNavbar';
const App: React.FC = () => const App: React.FC = () =>
{ {
@ -50,10 +59,14 @@ const App: React.FC = () =>
return ( return (
<MantineProvider withNormalizeCSS withGlobalStyles> <MantineProvider withNormalizeCSS withGlobalStyles>
<NotificationsProvider position="top-center" > <NotificationsProvider position="top-center" >
<AppShell
padding={0}
navbarOffsetBreakpoint={500}
navbar={<DogNavbar hasUser={user ? true : false} />}
>
<div className="App"> <div className="App">
<div className="col middle"> <div className="col middle">
<BrowserRouter basename='/dog/'> <BrowserRouter basename='/dog/'>
{user && <Header />}
<Routes> <Routes>
{user && <Route index path="/" element={<Profil/>} />} {user && <Route index path="/" element={<Profil/>} />}
{/* {user && <Route index path="/" element={<Home/>} />} */} {/* {user && <Route index path="/" element={<Home/>} />} */}
@ -69,11 +82,11 @@ const App: React.FC = () =>
{user && <Route path="/upload" element={<FileUpload/>} />} {user && <Route path="/upload" element={<FileUpload/>} />}
{user && <Route path="/profil" element={<Profil/>} />} {user && <Route path="/profil" element={<Profil/>} />}
</Routes> </Routes>
<Footer/>
</BrowserRouter> </BrowserRouter>
</div> </div>
</div> </div>
</AppShell>
</NotificationsProvider> </NotificationsProvider>
</MantineProvider> </MantineProvider>
); );

View File

@ -0,0 +1,26 @@
import { Navbar, Text } from '@mantine/core'
import React from 'react'
import Footer2 from './Footer2'
function DogNavbar({hasUser}:{hasUser: boolean})
{
return (
<Navbar
width={{ base: 100 }}
height={500}
hiddenBreakpoint={500}
hidden={true}
p="xs">
<Navbar.Section><Text>Titel</Text></Navbar.Section>
<Navbar.Section grow mt="md">{/* Links sections */}</Navbar.Section>
<Navbar.Section><Text>Login</Text></Navbar.Section>
<Navbar.Section><Text>Register</Text></Navbar.Section>
{hasUser && <Navbar.Section><Text>Profil</Text></Navbar.Section>}
{hasUser && <Navbar.Section><Text>QrCode</Text></Navbar.Section>}
{hasUser && <Navbar.Section><Text>Logout</Text></Navbar.Section>}
<Navbar.Section>Footer</Navbar.Section>
</Navbar> )
}
export default DogNavbar

View File

@ -1,10 +1,10 @@
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import './Footer.css'; import './Footer.css';
function Footer() { function Footer2() {
return ( return (
<div className="noprint"><Link to={'./Impressum'}>Impressum</Link></div> <div className="noprint"><Link to={'./Impressum'}>Impressum</Link></div>
); );
} }
export default Footer; export default Footer2;

View File

@ -5,7 +5,7 @@ import {logOut} from '../services/PhpApi'
import { notificationSuccess } from '../services/Notifications'; import { notificationSuccess } from '../services/Notifications';
function Header() function Header2()
{ {
const logOutForm = () => const logOutForm = () =>
{ {
@ -17,10 +17,9 @@ function Header()
return ( return (
<div className='logout InputForm'> <div className='logout InputForm'>
<div className='noprint'>Header</div>
<button onClick={logOutForm}>Logout</button> <button onClick={logOutForm}>Logout</button>
</div> </div>
); );
} }
export default Header; export default Header2;