-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
154 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react' | ||
|
||
export default function Button({children, type}) { | ||
let background; | ||
if(type === "simple") | ||
background = "bg-orange-button"; | ||
else if(type === "rugged") | ||
background = "bg-green-button"; | ||
else if(type ==="luxury") | ||
background = "bg-black-button"; | ||
else | ||
background = "bg-light-beige" | ||
return ( | ||
<button className={` px-5 py-2 rounded-md ${background} ${background ==="bg-light-beige" ? "text-gray-text" : "text-white capitalize w-[40%] car-button" }`}>{children}</button> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from "react"; | ||
import Button from "./Button"; | ||
/** | ||
* { | ||
* id: "1", | ||
* name: "Modest Explorer", | ||
* price: 60, | ||
* description: "The Modest Explorer is a van designed to get you out of the house and into nature. This beauty is equipped with solar panels, a composting toilet, a water tank and kitchenette. The idea is that you can pack up your home and escape for a weekend or even longer!", | ||
* imageUrl: "https://assets.scrimba.com/advanced-react/react-router/modest-explorer.png", | ||
* type: "simple" | ||
* } | ||
*/ | ||
export default function CarInfo({ name, price, description, image, type }) { | ||
return ( | ||
<div className="flex flex-col gap-5"> | ||
<div className="flex flex-col gap-8"> | ||
<img src={image} alt="Photo" className="rounded-md w-full" /> | ||
<div className="flex justify-between items-center font-bold text-[1.2rem]"> | ||
<p>{name}</p> | ||
<p className="">${price} / day</p> | ||
</div> | ||
</div> | ||
<Button type={type}>{type}</Button> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,49 @@ | ||
import React from "react"; | ||
import Button from "./Button"; | ||
import CarInfo from "./CarInfo"; | ||
import Footer from "./Footer"; | ||
|
||
export default function Vans() { | ||
// useState that hold the Date | ||
const [data, setData] = React.useState([]); | ||
// useEffect to fetch Data | ||
React.useEffect(() => { | ||
fetch("/api/vans") | ||
.then((res) => res.json()) | ||
.then((data) => setData(data.vans)); | ||
}, []); | ||
console.log(data); | ||
return ( | ||
<div> | ||
<h1>Welcome in Vans Page</h1> | ||
<div className="bg-main-background "> | ||
<div className="p-10 flex gap-10 flex-col"> | ||
<p className="font-bold text-[2rem]">Explore our van options</p> | ||
<div className="flex items-center justify-between text-gray-text flex-wrap gap-4"> | ||
<div className="flex gap-5 flex-wrap"> | ||
<Button type={"bg-light-beige"}>Simple</Button> | ||
<Button type={"bg-light-beige"}>Luxury</Button> | ||
<Button type={"bg-light-beige"}>Rugged</Button> | ||
</div> | ||
<div className=""> | ||
<button>Clear filters</button> | ||
<p className="w-full h-[0.1rem] bg-gray-text"></p> | ||
</div> | ||
</div> | ||
<div className="grid grid-cols-3 gap-10 car-content"> | ||
{data.map((van) => { | ||
return ( | ||
<CarInfo | ||
key={van.id} | ||
description={van.description} | ||
image={van.imageUrl} | ||
name={van.name} | ||
price={van.price} | ||
type={van.type} | ||
/> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
<Footer /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters