-
-
Notifications
You must be signed in to change notification settings - Fork 768
London10 | Adrian Ilovan | cyf-hotel-react #589
base: master
Are you sure you want to change the base?
Changes from 17 commits
eed0a04
bf1879b
55b8b8d
8660d90
0a1bf85
8dee235
322bf6d
20e65f2
1d5a9e9
a69f36b
a94bc9a
59d6f5a
710c5bd
95e9db2
7050966
a763ffe
70349ea
569896c
f65a9ff
84b0df2
5bc3c7c
6656614
9aaf351
57fe0bd
b857ed1
b437ec6
41bc53a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from "react"; | ||
|
||
const Footer = () => { | ||
|
||
const myProps = ["123 Fake Street, London, E1 4UD", "[email protected]", "0123 456789"]; | ||
return( | ||
<div className="footer"> | ||
<ul className="ul"> | ||
{myProps.map((item, index) => <li key={index}>{item}</li> | ||
)} | ||
</ul> | ||
</div> | ||
) | ||
|
||
|
||
} | ||
export default Footer; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from "react"; | ||
import "./App.css"; | ||
|
||
const Heading = () => { | ||
return( | ||
<header className="App-header"> | ||
<img alt="App-logo" className="App-logo" src="https://marketplace.canva.com/EAE8Xyb2xY8/1/0/1600w/canva-gold-exclusive-royal-luxury-hotel-logo-izeElzvImEY.jpg"></img> | ||
<h1>CYF Hotel</h1></header> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a minor point, but just keep an eye on the formatting of your embedded html. |
||
); | ||
} | ||
|
||
export default Heading; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React, { useState } from "react"; | ||
import RestaurantButton from "./RestaurantButton"; | ||
|
||
const Order = ({orderType}) => { | ||
const [orders, setOrders] = useState(0); | ||
|
||
const orderOne = () => { | ||
setOrders(orders + 1); | ||
}; | ||
|
||
return( | ||
<li> | ||
{orderType} {orders} <RestaurantButton onClick={orderOne}/> | ||
</li> | ||
|
||
) | ||
} | ||
|
||
export default Order; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React, { useState } from "react"; | ||
|
||
const RestaurantButton = ({ onClick }) => { | ||
return ( | ||
<button className="btn btn-primary" | ||
onClick={onClick} >Add</button> | ||
) | ||
|
||
|
||
} | ||
|
||
|
||
export default RestaurantButton; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from "react"; | ||
|
||
|
||
const SearchButton = () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice 👍 |
||
return( | ||
<button className="btn btn-primary">Search</button> | ||
); | ||
} | ||
|
||
export default SearchButton; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React, { useState } from "react"; | ||
import FakeBookings from "./data/fakeBookings.json"; | ||
import moment from "moment/moment"; | ||
|
||
const SearchResults = (props) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks great! |
||
const [selectedRows, setSelectedRows] = useState([]); | ||
const selectedClicks = (bookingId) => { | ||
setSelectedRows((selectedClickedRows) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Awesome - great work! 😄 |
||
if (selectedClickedRows.includes(bookingId)) { | ||
return selectedClickedRows.filter((id) => id !== bookingId) | ||
} else { | ||
return [...selectedClickedRows, bookingId]; | ||
} | ||
}); | ||
} | ||
|
||
|
||
return( | ||
<table className="table"> | ||
<thead> | ||
<tr> | ||
<th scope="col">Title</th> | ||
<th scope="col">First Name</th> | ||
<th scope="col">Surname</th> | ||
<th scope="col">Email</th> | ||
<th scope="col">Room ID</th> | ||
<th scope="col">CheckIn</th> | ||
<th scope="col">CheckOut</th> | ||
<th scope="col">Nights</th> | ||
</tr> | ||
</thead> | ||
<tbody className="tbody"> | ||
{props.bookings.map((booking, key) => ( | ||
<tr | ||
key={booking.id} | ||
className={selectedRows.includes(booking.id) ? "selected-row" : ""} | ||
onClick={() => selectedClicks(booking.id)}> | ||
<th scope="row">{booking.title}</th> | ||
<td>{booking.firstName}</td> | ||
<td>{booking.surname}</td> | ||
<td>{booking.email}</td> | ||
<td>{booking.roomId}</td> | ||
<td>{booking.checkInDate}</td> | ||
<td>{booking.checkOutDate}</td> | ||
<td>{moment(booking.checkOutDate).diff(booking.checkInDate, "days")}</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice 👏 |
||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
) | ||
}; | ||
export default SearchResults; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from "react"; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks great. But it seems like there's some duplication here - the structure of each card is the same, and we are repeating that structure 3 times. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I think I can create a separate component "const Card" and pass all object info in there so I can add any other card with ease . thanks for letting me know :) |
||
const TouristInfoCards = () => { | ||
return( | ||
<div className="card-container"> | ||
<img src="" alt=""></img> | ||
<div className="card"> | ||
<img className="card-img" src="https://media.istockphoto.com/id/1421242432/photo/glasgow-united-kingdom-aerial-shot-of-modern-buildings-in-the-central-area-of-the-city-with.jpg?s=612x612&w=0&k=20&c=5atqO3S6NsvBJazWGSyth82FhvVfgajQARHv8KQ0J-Q=" alt="glasgow"></img> | ||
<h4>Glasgow</h4> | ||
<p>Glasgow's city centre is home to flagship stores, impressive shopping centres and designer favourites all within an easily walkable area.</p> | ||
<a href="https://www.peoplemakeglasgow.com" className="btn btn-primary">More Information</a> | ||
</div> | ||
<img src="" alt=""></img> | ||
<div className="card"> | ||
<img className="card-img" src="https://media.istockphoto.com/id/1061647528/photo/view-of-a-footbridge-in-salford-quays-in-manchester-england.jpg?s=612x612&w=0&k=20&c=vl5COcWWCtvUM8Nu26oP2WUTfhP45wcGNN8nrbtjcsw=" alt="manchester"></img> | ||
<h4>Manchester</h4> | ||
<p>Manchester is one of the most exciting places to visit in the UK right now where everybody and anybody is very warmly welcomed.</p> | ||
<a href="https://www.visitmanchester.com" className="btn btn-primary">More Information</a> | ||
</div> | ||
<img src="" alt=""></img> | ||
<div className="card"> | ||
<img className="card-img" src="https://img.freepik.com/free-photo/panoramic-view-big-ben-london-sunset-uk_268835-1401.jpg?w=2000" alt="london"></img> | ||
<h4>London</h4> | ||
<p>Visit London, the official guide to England’s exciting capital. For more Information click the link and visit the wonders of London</p> | ||
<a href="https://www.visitlondon.com" className="btn btn-primary">More Information</a> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default TouristInfoCards; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sounds like this data should be passed into the component using React props. You can have a look at how props normally work here: https://www.w3schools.com/react/react_props.asp
Can you think of how to update the code so the data is defined in the parent component, and is passed to the Footer component as a prop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will make the updates , thanks :)