Skip to content

Commit

Permalink
feat: made search page responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
kumarshantanu01 committed Jan 25, 2022
1 parent 0e2fd3d commit d5a382c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 127 deletions.
18 changes: 10 additions & 8 deletions components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import "react-date-range/dist/theme/default.css"; // theme css file
import { DateRangePicker } from "react-date-range";
import { useRouter } from "next/router";

function Header({placeholder}) {
function Header({ placeholder }) {
{
/* INSERTING CALENDAR */
}
Expand All @@ -31,17 +31,17 @@ function Header({placeholder}) {
setsearchInput("");
};

const search = () =>{
const search = () => {
router.push({
pathname: '/search',
query:{
pathname: "/search",
query: {
location: searchInput,
startDate: startDate.toISOString(),
endDate: endDate.toISOString(),
noOfGuests,
}
},
});
}
};

const selectionRange = {
startDate: startDate,
Expand Down Expand Up @@ -87,7 +87,7 @@ function Header({placeholder}) {
<p className="hidden md:inline cursor-pointer">Become a host</p>
<GlobeAltIcon className="h-6 cursor-pointer" />

<div className="flex items-center space-x-2 border-2 p-2 rounded-full">
<div className="flex items-center space-x-2 border-2 p-2 rounded-full bg-white">
<MenuIcon className="h-6" />
<UserCircleIcon className="h-6" />
</div>
Expand Down Expand Up @@ -121,7 +121,9 @@ function Header({placeholder}) {
<button onClick={resetInput} className="flex-grow text-gray-500">
Cancel
</button>
<button onClick={search} className="flex-grow text-red-400">Serach</button>
<button onClick={search} className="flex-grow text-red-400">
Serach
</button>
</div>
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion components/InfoCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { StarIcon } from "@heroicons/react/solid";

function InfoCard({ img, location, title, description, star, price, total }) {
return (
<div className="flex py-7 px-2 pr-4 border-b cursor-pointer hover:opacity-80 hover:shadow-lg transition duration-200 ease-out first:border-t">
<div className="sm:flex py-7 px-2 pr-4 border-b cursor-pointer hover:opacity-80 hover:shadow-lg transition duration-200 ease-out first:border-t">
<div className="relative h-24 w-40 md:h-52 md:w-80 flex-shrink-0">
<Image src={img} layout="fill" objectFit="cover" className="rounded-2xl" />
</div>
Expand Down
4 changes: 2 additions & 2 deletions pages/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Search({ searchResults }) {
return (
<div>
<Header placeholder={`${location} | ${range} | ${noOfGuests} guests`} />
<main className="flex">
<main className="xl:flex">
<section className="flex-grow pt-14 px-6">
<p className="text-xs">
200+ stays - {range} - for {noOfGuests} guests
Expand Down Expand Up @@ -56,7 +56,7 @@ function Search({ searchResults }) {
)}
</div>
</section>
<section className="hidden xl:inline-flex min-w-[600px]">
<section className="overflow-hidden w-auto max-h-[500px] xl:min-w-[600px] xl:max-h-max">
<Map searchResults={searchResults} />
{/* passing search results to maps for accessing longitude and latitude */}
</section>
Expand Down
116 changes: 0 additions & 116 deletions styles/Home.module.css
Original file line number Diff line number Diff line change
@@ -1,116 +0,0 @@
/* .container {
padding: 0 2rem;
}
.main {
min-height: 100vh;
padding: 4rem 0;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.footer {
display: flex;
flex: 1;
padding: 2rem 0;
border-top: 1px solid #eaeaea;
justify-content: center;
align-items: center;
}
.footer a {
display: flex;
justify-content: center;
align-items: center;
flex-grow: 1;
}
.title a {
color: #0070f3;
text-decoration: none;
}
.title a:hover,
.title a:focus,
.title a:active {
text-decoration: underline;
}
.title {
margin: 0;
line-height: 1.15;
font-size: 4rem;
}
.title,
.description {
text-align: center;
}
.description {
margin: 4rem 0;
line-height: 1.5;
font-size: 1.5rem;
}
.code {
background: #fafafa;
border-radius: 5px;
padding: 0.75rem;
font-size: 1.1rem;
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
Bitstream Vera Sans Mono, Courier New, monospace;
}
.grid {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
max-width: 800px;
}
.card {
margin: 1rem;
padding: 1.5rem;
text-align: left;
color: inherit;
text-decoration: none;
border: 1px solid #eaeaea;
border-radius: 10px;
transition: color 0.15s ease, border-color 0.15s ease;
max-width: 300px;
}
.card:hover,
.card:focus,
.card:active {
color: #0070f3;
border-color: #0070f3;
}
.card h2 {
margin: 0 0 1rem 0;
font-size: 1.5rem;
}
.card p {
margin: 0;
font-size: 1.25rem;
line-height: 1.5;
}
.logo {
height: 1em;
margin-left: 0.5rem;
}
@media (max-width: 600px) {
.grid {
width: 100%;
flex-direction: column;
}
} */

1 comment on commit d5a382c

@vercel
Copy link

@vercel vercel bot commented on d5a382c Jan 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.