diff --git a/autok/frontend/package-lock.json b/autok/frontend/package-lock.json index ba28baa..27090fd 100644 --- a/autok/frontend/package-lock.json +++ b/autok/frontend/package-lock.json @@ -12,6 +12,7 @@ "daisyui": "^5.7.47", "react": "^19.2.8", "react-dom": "^19.2.8", + "react-router-dom": "^7.18.5", "tailwindcss": "^4.3.3" }, "devDependencies": { @@ -1537,6 +1538,19 @@ "dev": true, "license": "MIT" }, + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -2656,6 +2670,44 @@ "react": "^19.3.0" } }, + "node_modules/react-router": { + "version": "7.18.5", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.5.tgz", + "integrity": "sha512-dTgvcXDOrLPrlLHrcZAqWveiK1hMSqN+rGAJzegP8HtmNkfRxOoshGWBNX3ZJ0cZjOHkRdlUJtaIhZMLLyGyPw==", + "license": "MIT", + "dependencies": { + "cookie": "^1.0.1", + "set-cookie-parser": "^2.6.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + } + } + }, + "node_modules/react-router-dom": { + "version": "7.18.5", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.5.tgz", + "integrity": "sha512-9HcfDMU6JJ/fp6gJZYGwNE6RknVGS4kBjH1HkNw959mCJi70TVwdipQWv2FEol9uGpi+SZTFtVpJPtEQfayeOw==", + "license": "MIT", + "dependencies": { + "react-router": "7.18.5" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18" + } + }, "node_modules/rolldown": { "version": "1.2.12", "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.12.tgz", @@ -2705,6 +2757,12 @@ "semver": "bin/semver.js" } }, + "node_modules/set-cookie-parser": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.3.tgz", + "integrity": "sha512-irZHtTqurLna57KQG/s+fzOwv/J6XSH4cs8M/vsrY3uCaQ3S6+QJguAH0WdN47SXlk82voMZ4naWMQf8fdEoIg==", + "license": "MIT" + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", diff --git a/autok/frontend/package.json b/autok/frontend/package.json index 23431f1..7963aaa 100644 --- a/autok/frontend/package.json +++ b/autok/frontend/package.json @@ -14,6 +14,7 @@ "daisyui": "^5.7.47", "react": "^19.2.8", "react-dom": "^19.2.8", + "react-router-dom": "^7.18.5", "tailwindcss": "^4.3.3" }, "devDependencies": { diff --git a/autok/frontend/src/App.jsx b/autok/frontend/src/App.jsx index 2058f37..8552c77 100644 --- a/autok/frontend/src/App.jsx +++ b/autok/frontend/src/App.jsx @@ -1,11 +1,24 @@ +import Menu from "./components/Menu"; +import Main from "./components/Main"; +import Autok from "./components/Autok"; +import AutoForm from "./components/AutoForm"; + +import {BrowserRouter,Routes,Route,Navigate} from 'react-router-dom'; function App() { - - return (
+ + + + } /> + }/> + }/> + } /> + +
) } diff --git a/autok/frontend/src/components/Auto.jsx b/autok/frontend/src/components/Auto.jsx new file mode 100644 index 0000000..ca854e2 --- /dev/null +++ b/autok/frontend/src/components/Auto.jsx @@ -0,0 +1,20 @@ + + +function Auto({ auto }) { + return ( +
+
+

{auto.marka} {auto.tipus}

+

{auto.kor}

+

{auto.rendszam}

+

{auto.szin}

+
+ + +
+
+
+ ) +} + +export default Auto \ No newline at end of file diff --git a/autok/frontend/src/components/AutoForm.jsx b/autok/frontend/src/components/AutoForm.jsx new file mode 100644 index 0000000..0503425 --- /dev/null +++ b/autok/frontend/src/components/AutoForm.jsx @@ -0,0 +1,44 @@ +import { useState } from "react" +import { useNavigate } from "react-router-dom" + +function AutoForm() { + const navigate=useNavigate(); + + const[marka,setMarka]=useState(""); + const[tipus,setTipus]=useState(""); + const[kor,setKor]=useState(0); + const[rendszam,setRendszam]=useState(""); + const[szin,setSzin]=useState(""); + + const adatkuldes=(adat)=>{ + fetch('http://localhost:3000/autok',{ + method:"POST", + headers:{ + "Content-type":"application/json" + }, + body:JSON.stringify(adat) + }) + .then(res=>res.text()) + .then(valasz=>alert(valasz)) + .catch(err=>alert(err)); + + } + + const onSubmit=(e)=>{ + e.preventDefault(); + adatkuldes({marka,tipus,kor,rendszam,szin}); + navigate("/autok"); + } + + + + return ( +
+
+ +
+
+ ) +} + +export default AutoForm \ No newline at end of file diff --git a/autok/frontend/src/components/Autok.jsx b/autok/frontend/src/components/Autok.jsx new file mode 100644 index 0000000..bf71944 --- /dev/null +++ b/autok/frontend/src/components/Autok.jsx @@ -0,0 +1,34 @@ +import { useState, useEffect } from "react"; +import Auto from "./Auto"; + +function Autok() { + const[autok,setAutok]=useState([]); + const letolt=async ()=>{ + try { + let keres=await fetch('http://localhost:3000/autok'); + let valasz=await keres.json(); + + setAutok(valasz); + + } catch (error) { + alert(err); + } + + } + + useEffect(()=>{ + letolt(); + },[]) + return ( +
+

Autóink

+
+ { + autok.map((auto)=>()) + } +
+
+ ) +} + +export default Autok \ No newline at end of file diff --git a/autok/frontend/src/components/Main.jsx b/autok/frontend/src/components/Main.jsx new file mode 100644 index 0000000..d0e81b8 --- /dev/null +++ b/autok/frontend/src/components/Main.jsx @@ -0,0 +1,25 @@ + + +function Main() { + return ( +
+
+ Tailwind CSS hero component +
+

Box Office News!

+

+ Provident cupiditate voluptatem et in. Quaerat fugiat ut assumenda excepturi exercitationem + quasi. In deleniti eaque aut repudiandae et a id nisi. +

+ +
+
+
+ ) +} + +export default Main \ No newline at end of file diff --git a/autok/frontend/src/components/Menu.jsx b/autok/frontend/src/components/Menu.jsx new file mode 100644 index 0000000..287362c --- /dev/null +++ b/autok/frontend/src/components/Menu.jsx @@ -0,0 +1,19 @@ +import { Link } from "react-router-dom" + +function Menu() { + return ( +
+
+ Főoldal +
+
+ +
+
+ ) +} + +export default Menu \ No newline at end of file