Coder Social home page Coder Social logo

airebnb's Introduction

Aire Bnb

Airbnb listings search page, using NextJS, React, React Context, Tailwind CSS, Date Picker, Mapbox, GeoLib, Rapid Api, Axios, React Slick Carousel, NextJS Progress Bar, MomentJS, Lodash

API: https://airbnb13.p.rapidapi.com/
Live Link: https://aire-bnb.vercel.app

Pages and Routes

Index
|
├──Header.js <==> routes to search page
|  └───DateRangePicker
|
├───Banner.js <==> routes to local-listings page
|
├───Explore.js
|   └───SmallCard.js
|
├───LiveAnywhere.js
|   └───MediumCard.js <==> routes to local-listings page
|
├───LargeCard.js
|
└───Footer.js

LocalListings
|
├──Header.js <==> routes to search page
|  └───DateRangePicker
|
├───InfoCard.js
|
├───Maps.js
|
└───Footer.js

Search
|
├──Header.js <==> routes to search page
|  └───DateRangePicker
|
├───InfoCard.js
|
├───Maps.js
|
└───Footer.js

Index Page

Route="/"

The root of the application is the index page. It requests the user's location and if accepted, fetches local airbnb listings inside useEffect. If local listings are available, the Explore Nearby and Live Anywhere sections populate. To avoid redundant api calls, local listings are cached into localStorage so subsequent visits to the homepage read cached data. Error handling routes to the Nextjs error page if the api call fails. Renders the header, banner (passing it localListings), explore (passing it the first 8 localListings), live anywhere (passing it propertyTypes), largecard, and footer components.

Header

Renders a navbar with an airbnb logo which links to the homepage, a location search input, and some icons. If the search input is being typed in, a DateRangePicker component is rendered which sets a start and end date, as well as the number of guests. On clicking the search button, the search page is routed to and the location, start/end dates, and number of guests are passed as query params.

Banner

Recieves localListings prop from index page and on click of the banner, sets the localListings into context and routes to the local-listings page

Explore

Recieves localListings prop from index page and renders the SmallCard component for each listing, passing in the image, city, type, and url

SmallCard

Recieves image, city, type, and url props from Explore component and renders that data in a small card

LiveAnywhere

Recieves propertyTypes prop from index page and renders a MediumCard for each propertyType array. It passes MediumCard an image, the proprty's type, and the propertyType array

MediumCard

Recieves image, type, and properties array from LiveAnywhere component. It renders a the image and type in a medium card. On click, it sets the properties into context and routes to the local-listings page.

LargeCard

Renders a large image and contains a button that links to airbnb.com

Footer

Renders informational links to various parts of airbnb.com

LocalListings Page

Route="/local-listings"

Renders the header, InfoCard, Maps, and footer components. Reads listing data from context. For each of the listings, it renders an infocard component, passing it details about the listing. It aslo renders a maps component, passing in the lisings data. It also renders a section that contains a list of buttons that filter the listings data by different metrics.

Search Page

Route="/search"

Renders the header, InfoCard, Maps, and footer components. Reads location, startDate, endDate, numberGuests from router query params. Runs getServerSideProps, fetches airbnb lisitng data based on those query params. For each of the listings, it renders an infocard component, passing it details about the listing. It aslo renders a maps component, passing in the lisings data. It also renders a section that contains a list of buttons that filter the listings data by different metrics.

InfoCard

Recieves details about a listing as props and renders them in a card. Displays an image carousel usinf react slick slider.

Maps

Recieves listings data as props and renders a Map components from react-map-gl. The map is centered on the average coordinated of each listing, computed using geolib. The map renders a marker for each listing, based in the listing's coordinates. Clicking a marker opens the listing's image as a popup.

airebnb's People

Contributors

abdul-sayed avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

adam-street

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.