From 680f38b1c48c4cc5c4b34b285f68fe48217d0ab9 Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Thu, 25 Jul 2024 22:54:55 +0530 Subject: setting up login --- package.json | 3 ++- src/components/AdCard.jsx | 13 +++++++++++++ src/components/AdForm.jsx | 40 ++++++++++++++++++++++++++++++++++++++++ src/components/Navbar.jsx | 14 ++++++++++++++ src/main.jsx | 29 ++++++++++++++++++++--------- src/pages/Dashboard.jsx | 14 ++++++++++++++ src/pages/Login.jsx | 24 ++++++++++++++++++++++++ src/pages/ManageAds.jsx | 35 +++++++++++++++++++++++++++++++++++ src/pages/Register.jsx | 21 +++++++++++++++++++++ src/utils/api.js | 32 ++++++++++++++++++++++++++++++++ yarn.lock | 20 ++++++++++++++++++++ 11 files changed, 235 insertions(+), 10 deletions(-) create mode 100644 src/components/AdCard.jsx create mode 100644 src/components/AdForm.jsx create mode 100644 src/components/Navbar.jsx create mode 100644 src/pages/Dashboard.jsx create mode 100644 src/pages/Login.jsx create mode 100644 src/pages/ManageAds.jsx create mode 100644 src/pages/Register.jsx create mode 100644 src/utils/api.js diff --git a/package.json b/package.json index 056b32f..1c236c5 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ }, "dependencies": { "react": "^18.3.1", - "react-dom": "^18.3.1" + "react-dom": "^18.3.1", + "react-router-dom": "^6.25.1" }, "devDependencies": { "@types/react": "^18.3.3", diff --git a/src/components/AdCard.jsx b/src/components/AdCard.jsx new file mode 100644 index 0000000..6e854ed --- /dev/null +++ b/src/components/AdCard.jsx @@ -0,0 +1,13 @@ +import React from 'react'; + +const AdCard = ({ ad }) => { + return ( +
+

{ad.title}

+

{ad.description}

+ {ad.title} +
+ ); +}; + +export default AdCard; diff --git a/src/components/AdForm.jsx b/src/components/AdForm.jsx new file mode 100644 index 0000000..3274803 --- /dev/null +++ b/src/components/AdForm.jsx @@ -0,0 +1,40 @@ +import React, { useState } from 'react'; + +const AdForm = ({ onAddAd }) => { + const [title, setTitle] = useState(''); + const [description, setDescription] = useState(''); + const [image, setImage] = useState(''); + + const handleSubmit = (e) => { + e.preventDefault(); + onAddAd({ title, description, image }); + setTitle(''); + setDescription(''); + setImage(''); + }; + + return ( +
+ setTitle(e.target.value)} + /> +