init Layout
This commit is contained in:
@@ -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
|
||||||
|
|||||||
9
react-advanced-tag1/src/components/Footer.tsx
Normal file
9
react-advanced-tag1/src/components/Footer.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
function Footer() {
|
||||||
|
return (
|
||||||
|
<footer>
|
||||||
|
<p>© 2025 Your Company</p>
|
||||||
|
</footer>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Footer;
|
||||||
9
react-advanced-tag1/src/components/Header/Navigation.tsx
Normal file
9
react-advanced-tag1/src/components/Header/Navigation.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export default function Navigation () {
|
||||||
|
return (
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li>home</li>
|
||||||
|
<li>test</li>
|
||||||
|
</ul>
|
||||||
|
</nav>);
|
||||||
|
}
|
||||||
12
react-advanced-tag1/src/components/Header/index.tsx
Normal file
12
react-advanced-tag1/src/components/Header/index.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import Navigation from "./Navigation";
|
||||||
|
|
||||||
|
const Header = () => {
|
||||||
|
return (
|
||||||
|
<header>
|
||||||
|
<h2>My Application</h2>
|
||||||
|
<Navigation />
|
||||||
|
</header>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Header;
|
||||||
7
react-advanced-tag1/src/components/globals/Heading.tsx
Normal file
7
react-advanced-tag1/src/components/globals/Heading.tsx
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export default function Heading({title = "Hallo Teilnehmer"}: {title?: string}): React.ReactElement {
|
||||||
|
return (
|
||||||
|
<h1 >
|
||||||
|
{title}
|
||||||
|
</h1>
|
||||||
|
);
|
||||||
|
}
|
||||||
12
react-advanced-tag1/src/layouts/MainLayout.tsx
Normal file
12
react-advanced-tag1/src/layouts/MainLayout.tsx
Normal 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 />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user