-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from dheffer/garage-layout-work
Garage page formatted with cards for display
- Loading branch information
Showing
21 changed files
with
516 additions
and
107 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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 was deleted.
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 was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
import {Link} from "react-router-dom"; | ||
import {Nav, Navbar} from "react-bootstrap"; | ||
import Container from "react-bootstrap/Container"; | ||
import React from "react"; | ||
|
||
function NavBar() { | ||
return ( | ||
<div> | ||
<Link to="/">Home</Link> | ||
<Link to="/login">Login</Link> | ||
<Link to="/garage">Garage</Link> | ||
<Link to="/settings">Settings</Link> | ||
</div> | ||
<Navbar expand="lg" className="bg-body-tertiary"> | ||
<Container> | ||
<Navbar.Brand href="/garage">Driveline</Navbar.Brand> | ||
<Navbar.Toggle /> | ||
<Navbar.Collapse> | ||
<Nav> | ||
<Nav.Link href="/garage">Garage</Nav.Link> | ||
<Nav.Link href="/settings">Settings</Nav.Link> | ||
</Nav> | ||
|
||
</Navbar.Collapse> | ||
<Nav className={"ms-auto"}> | ||
<Navbar.Text >Signed in as: placeholder</Navbar.Text> | ||
</Nav> | ||
</Container> | ||
</Navbar> | ||
); | ||
} | ||
|
||
export default NavBar; | ||
export default NavBar; |
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {Link} from "react-router-dom"; | ||
import {Button} from "react-bootstrap"; | ||
|
||
function AddRemoveNavbar() { | ||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
export default AddRemoveNavbar; |
File renamed without changes.
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,78 @@ | ||
import {BrowserRouter, Routes, Route, Link, useNavigate, useParams} from "react-router-dom"; | ||
import VehicleInfo from "../vehicle/VehicleInfo"; | ||
import Accordion from 'react-bootstrap/Accordion'; | ||
import {Button, Card, Col, Row} from "react-bootstrap"; | ||
import Container from 'react-bootstrap/Container'; | ||
|
||
// TODO: REPLACE WITH REAL VALUES, THESE ARE USED AS TEST VALUES | ||
|
||
|
||
function Garage() { | ||
// Divide the vehicles array into chunks of 3 | ||
const vehicles = ["2009 Nord Campy", "2015 Yotota Bav", "2019 Pesla Godel3", "2014 Nord Bustang", | ||
"2017 Yotota Camry", "2016 Pesla GodelS", "2018 Nord Bustang", "2010 Yotota Bav"] | ||
const chunkedVehicles = []; | ||
let length = 0; | ||
for (let i = 0; i < vehicles.length; i += 3) { | ||
chunkedVehicles.push(vehicles.slice(i, i + 3)); | ||
} | ||
|
||
return ( | ||
<div className="container"> | ||
<div className="row"> | ||
<div className="col-md-1 order-md-1"></div> | ||
<div className="col-md-10 order-md-2"> | ||
<div className="d-flex justify-content-evenly"> | ||
<Link to="/garage/add"><Button>Add</Button></Link> | ||
<Routes> | ||
<Route path="/garage/add"/> | ||
<Route path="/garage/remove/:vehicle"/> | ||
<Route path={"/garage/vehicle-info/:vehicle"} element={<VehicleInfo/>}/> | ||
</Routes> | ||
</div> | ||
|
||
{chunkedVehicles.map((row, rowIndex) => ( | ||
<Row key={rowIndex} xs={1} md={3} className="g-4"> | ||
{/* Map over vehicles in the current row */} | ||
{row.map((vehicle, colIndex) => { | ||
let param = vehicle.replaceAll(" ", "-").toLowerCase(); | ||
let year = vehicle.split(" ")[0]; | ||
let model = vehicle.split(" ")[1]; | ||
let make = vehicle.split(" ")[2]; | ||
model = model[0].toUpperCase() + model.slice(1); | ||
make = make[0].toUpperCase() + make.slice(1); | ||
|
||
return ( | ||
<Col key={colIndex}> | ||
<Card style={{width: '22rem'}} id={rowIndex + "-" + colIndex}> | ||
<Card.Img variant="top" | ||
src="https://cdn.dealerk.it/cars/placeholder/placeholder-800.png"/> | ||
<Card.Body> | ||
<Card.Title>{vehicle}</Card.Title> | ||
<Card.Text> | ||
Some quick example text to build on the card title and make up the bulk of | ||
the card's content. | ||
</Card.Text> | ||
<Card.Footer className="d-flex justify-content-around"> | ||
<Link to={"/garage/vehicle-info/" + param}> | ||
<Button className={"btn btn-primary"}>View Info</Button> | ||
</Link> | ||
<Link to={"/garage/remove/" + param}> | ||
<Button>Remove</Button> | ||
</Link> | ||
</Card.Footer> | ||
</Card.Body> | ||
</Card> | ||
</Col> | ||
); | ||
})} | ||
</Row> | ||
))} | ||
</div> | ||
<div className="col-md-1 order-md-3"></div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Garage; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,47 @@ | ||
import {BrowserRouter, Routes, Route, useParams} from "react-router-dom"; | ||
import VehicleNavbar from "./VehicleNavbar"; | ||
import {Card, Col, Row} from "react-bootstrap"; | ||
|
||
function VehicleInfo() { | ||
let { vehicle } = useParams(); | ||
let parsed = vehicle.replaceAll("-", " "); | ||
let year = parsed.split(" ")[0]; | ||
let model = parsed.split(" ")[1] | ||
let make = parsed.split(" ")[2]; | ||
model = model[0].toUpperCase() + model.slice(1); | ||
make = make[0].toUpperCase() + make.slice(1); | ||
return ( | ||
<div> | ||
<VehicleNavbar /> | ||
<Routes> | ||
<Route path="/garage/vehicle-info/:vehicle" /> | ||
<Route path="/garage/vehicle-history/:vehicle" /> | ||
</Routes> | ||
|
||
<p>{year} {model} {make}</p> | ||
|
||
</div> | ||
); | ||
} | ||
|
||
export default VehicleInfo; | ||
|
||
|
||
|
||
<Row xs={1} md={2} className="g-4"> | ||
{Array.from({ length: 4 }).map((_, idx) => ( | ||
<Col key={idx}> | ||
<Card> | ||
<Card.Img variant="top" src="holder.js/100px160" /> | ||
<Card.Body> | ||
<Card.Title>Card title</Card.Title> | ||
<Card.Text> | ||
This is a longer card with supporting text below as a natural | ||
lead-in to additional content. This content is a little bit | ||
longer. | ||
</Card.Text> | ||
</Card.Body> | ||
</Card> | ||
</Col> | ||
))} | ||
</Row> |
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,15 @@ | ||
import {Link, useParams} from "react-router-dom"; | ||
|
||
function VehicleNavbar() { | ||
let { vehicle } = useParams(); | ||
let param = vehicle.replaceAll(" ", "-").toLowerCase(); | ||
|
||
return ( | ||
<div> | ||
<Link to={"/garage/vehicle-info/"+param}>Info</Link> | ||
<Link to={"/garage/vehicle-history/"+param} >History</Link> | ||
</div> | ||
); | ||
} | ||
|
||
export default VehicleNavbar; |