Add backend and frontend structure with routing, components, and styling

- Implemented Express server with CORS and dotenv support
- Created basic routing with React Router in frontend
- Added Admin and Home components with navigation
- Integrated MainForm component for user input
- Updated package.json and package-lock.json with new dependencies
- Styled components using Tailwind CSS and Lucide icons
- Added error handling in server
- Created initial EJS view for backend
This commit is contained in:
2025-08-11 18:29:06 +02:00
parent 38b02c186f
commit ba62beb90d
12 changed files with 322 additions and 10 deletions

View File

@@ -1,14 +1,16 @@
import "./App.css";
import Layout from "./layout/Layout";
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import Admin from './components/Admin'; // Beispiel-Komponente
import Home from './components/Home'; // Beispiel-Komponente
function App() {
return (
<>
<Layout>
<h1>Hello World</h1>
</Layout>
</>
<Router>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/admin" element={<Admin />} />
</Routes>
</Router>
);
}
export default App;
export default App;

View File

@@ -0,0 +1,11 @@
import React from "react";
const Admin: React.FC = () => {
return (
<>
<h1>Admin</h1>
</>
);
};
export default Admin;

View File

@@ -1,9 +1,26 @@
import React from "react";
import { Award, RectangleEllipsis } from "lucide-react";
const Header: React.FC = () => {
return (
<header>
<h1>Header</h1>
<header className="w-full border-b border-black/10 bg-gray-100/95 shadow-sm">
<div className="mx-auto flex max-w-7xl items-center justify-between px-4 py-3 md:px-6">
<div className="flex items-center gap-3">
<Award className="h-8 w-8 text-black" strokeWidth={2.6} />
<h1 className="text-2xl font-black tracking-tight text-neutral-900 md:text-3xl">
MCS Lose
</h1>
</div>
<a href="/admin">
<button
type="button"
className="inline-flex items-center gap-2 rounded-xl border border-black/10 bg-gray-200/90 px-4 py-2 font-semibold text-neutral-900 shadow-inner transition hover:bg-gray-300/90"
>
<RectangleEllipsis className="h-5 w-5" />
Login
</button>
</a>
</div>
</header>
);
};

View File

@@ -0,0 +1,15 @@
import "../App.css";
import Layout from "../layout/Layout";
import MainForm from "./MainForm";
function App() {
return (
<>
<Layout>
<MainForm />
</Layout>
</>
);
}
export default App;

View File

@@ -0,0 +1,125 @@
import React from "react";
const MainForm: React.FC = () => {
return (
<section className="mx-auto mt-10 w-full max-w-lg rounded-3xl border border-black/10 bg-zinc-200/90 p-6 shadow-lg backdrop-blur-sm">
<h2 className="text-2xl font-black text-zinc-900">Los registrieren</h2>
<p className="mt-1 text-xs text-zinc-500">
* alle Informationen werden benötigt
</p>
<form className="mt-5 space-y-4">
<div className="space-y-1">
<label
htmlFor="losnummer"
className="text-sm font-medium text-zinc-800"
>
Losnummer:
</label>
<input
type="text"
id="losnummer"
placeholder="XXXX-XXXX-XXXX-XXXX"
required
className="w-full rounded-xl border border-black/25 bg-white/80 px-4 py-2.5 text-sm text-zinc-800 placeholder-zinc-400 shadow-inner outline-none ring-0 transition focus:border-black/40 focus:ring-2 focus:ring-black/10"
/>
</div>
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<div className="space-y-1">
<label
htmlFor="vorname"
className="text-sm font-medium text-zinc-800"
>
Vorname:
</label>
<input
type="text"
id="vorname"
placeholder="Max"
required
className="w-full rounded-xl border border-black/25 bg-white/80 px-4 py-2.5 text-sm text-zinc-800 placeholder-zinc-400 shadow-inner outline-none focus:border-black/40 focus:ring-2 focus:ring-black/10"
/>
</div>
<div className="space-y-1">
<label
htmlFor="nachname"
className="text-sm font-medium text-zinc-800"
>
Nachname:
</label>
<input
type="text"
id="nachname"
placeholder="Mustermann"
required
className="w-full rounded-xl border border-black/25 bg-white/80 px-4 py-2.5 text-sm text-zinc-800 placeholder-zinc-400 shadow-inner outline-none focus:border-black/40 focus:ring-2 focus:ring-black/10"
/>
</div>
</div>
<div className="space-y-1">
<label
htmlFor="strasse"
className="text-sm font-medium text-zinc-800"
>
Straße + Haus Nr.:
</label>
<input
type="text"
id="strasse"
placeholder="Musterstraße 1"
required
className="w-full rounded-xl border border-black/25 bg-white/80 px-4 py-2.5 text-sm text-zinc-800 placeholder-zinc-400 shadow-inner outline-none focus:border-black/40 focus:ring-2 focus:ring-black/10"
/>
</div>
<div className="space-y-1">
<label htmlFor="plz" className="text-sm font-medium text-zinc-800">
Postleitzahl + Ort:
</label>
<input
type="text"
id="plz"
placeholder="12345 Musterstadt"
required
className="w-full rounded-xl border border-black/25 bg-white/80 px-4 py-2.5 text-sm text-zinc-800 placeholder-zinc-400 shadow-inner outline-none focus:border-black/40 focus:ring-2 focus:ring-black/10"
/>
</div>
<div className="space-y-1">
<label htmlFor="email" className="text-sm font-medium text-zinc-800">
E-Mail:
</label>
<input
type="email"
id="email"
placeholder="max@mustermann.de"
required
className="w-full rounded-xl border border-black/25 bg-white/80 px-4 py-2.5 text-sm text-zinc-800 placeholder-zinc-400 shadow-inner outline-none focus:border-black/40 focus:ring-2 focus:ring-black/10"
/>
</div>
<button
type="submit"
className="mt-2 w-full rounded-xl bg-blue-600 px-4 py-3 text-base font-bold text-white shadow transition hover:bg-blue-700 active:bg-blue-800"
>
Los Registrieren
</button>
<p className="mt-1 text-xs text-zinc-500">
Wenn Sie die Daten eines Loses bearbeiten möchten,{" "}
<a
className="text-blue-600 underline"
href="mailto:example@example.com"
>
kontaktieren Sie uns
</a>
.
</p>
</form>
</section>
);
};
export default MainForm;

View File

@@ -1,5 +1,6 @@
import React from "react";
import Header from "../components/Header";
import "../App.css";
type LayoutProps = {
children: React.ReactNode;