init Layout

This commit is contained in:
e560248
2025-04-07 10:47:15 +02:00
parent 131537f1fa
commit 08e2459408
6 changed files with 54 additions and 28 deletions

View File

@@ -1,35 +1,12 @@
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css' import './App.css'
import Heading from './components/globals/Heading'
import MainLayout from './layouts/MainLayout'
function App() { function App() {
const [count, setCount] = useState(0)
return ( return <MainLayout>
<> <Heading />
<div> </MainLayout>
<a href="https://vite.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
</>
)
} }
export default App export default App

View File

@@ -0,0 +1,9 @@
function Footer() {
return (
<footer>
<p>&copy; 2025 Your Company</p>
</footer>
);
}
export default Footer;

View File

@@ -0,0 +1,9 @@
export default function Navigation () {
return (
<nav>
<ul>
<li>home</li>
<li>test</li>
</ul>
</nav>);
}

View File

@@ -0,0 +1,12 @@
import Navigation from "./Navigation";
const Header = () => {
return (
<header>
<h2>My Application</h2>
<Navigation />
</header>
);
}
export default Header;

View File

@@ -0,0 +1,7 @@
export default function Heading({title = "Hallo Teilnehmer"}: {title?: string}): React.ReactElement {
return (
<h1 >
{title}
</h1>
);
}

View File

@@ -0,0 +1,12 @@
import Footer from "../components/Footer";
import Header from "../components/Header";
export default function MainLayout({children}: {children: React.ReactNode | React.ReactElement | React.ReactElement[]}): React.ReactElement {
return (
<>
<Header />
{children}
<Footer />
</>
);
}