From 5c96af8b6c2544bd1c42c2a75d208397f8896130 Mon Sep 17 00:00:00 2001 From: QkoSad Date: Fri, 2 Dec 2022 08:14:14 +0200 Subject: [PATCH] add listings added --- src/App.js | 5 + src/components/ListingItem.jsx | 58 ++++++ src/components/Navbar.jsx | 2 +- src/components/PrivateRoute.jsx | 1 - src/pages/Category.jsx | 86 +++++++++ src/pages/CreateListing.jsx | 317 ++++++++++++++++++++++++++++++++ src/pages/Explore.jsx | 26 ++- src/pages/Offers.jsx | 83 ++++++++- src/pages/Profile.jsx | 7 + 9 files changed, 574 insertions(+), 11 deletions(-) create mode 100644 src/components/ListingItem.jsx create mode 100644 src/pages/Category.jsx create mode 100644 src/pages/CreateListing.jsx diff --git a/src/App.js b/src/App.js index 399c37b..1f38123 100644 --- a/src/App.js +++ b/src/App.js @@ -9,6 +9,8 @@ import ForgotPassword from "./pages/ForgotPassword"; import Offers from "./pages/Offers"; import Signin from "./pages/Signin"; import Signup from "./pages/Signup"; +import Category from "./pages/Category"; +import CreateLising from "./pages/CreateListing"; function App() { return ( @@ -17,12 +19,15 @@ function App() { } /> } /> + } /> + }> } /> } /> } /> } /> + } /> diff --git a/src/components/ListingItem.jsx b/src/components/ListingItem.jsx new file mode 100644 index 0000000..a806b36 --- /dev/null +++ b/src/components/ListingItem.jsx @@ -0,0 +1,58 @@ +import { Link } from "react-router-dom"; +import { ReactComponent as DeleteIcon } from "../assets/svg/deleteIcon.svg"; +import bedIcon from "../assets/svg/bedIcon.svg"; +import bathtubIcon from "../assets/svg/bathtubIcon.svg"; + +function ListingItem({ listing, id, onDelete }) { + return ( +
  • + + {listing.name} +
    +

    {listing.location}

    +

    {listing.name}

    +

    + $ + {listing.offer + ? listing.discountedPrice + .toString() + .replace(/\B(?=(\d{3})+(?!\d))/g, ",") + : listing.regularPrice + .toString() + .replace(/\B(?=(\d{3})+(?!\d))/g, ",")} + {listing.type === "rent" && " / Month"} +

    +
    + bed +

    + {listing.bedrooms > 1 + ? `${listing.bedrooms} Bedrooms` + : "1 Bedrooms"} +

    + bath +

    + {listing.bathrooms > 1 + ? `${listing.bathrooms} Bedrooms` + : "1 Bathrooms"} +

    +
    +
    + + {onDelete && ( + onDelete(listing.id, listing.name)} + /> + )} +
  • + ); +} +export default ListingItem; diff --git a/src/components/Navbar.jsx b/src/components/Navbar.jsx index 845d79b..3b81eb7 100644 --- a/src/components/Navbar.jsx +++ b/src/components/Navbar.jsx @@ -16,7 +16,7 @@ function Navbar() {