-
-
Notifications
You must be signed in to change notification settings - Fork 767
London10_Afsha_Hossain_cyf-hotel-react_React_Week1 #600
base: master
Are you sure you want to change the base?
Changes from 16 commits
2f3a0ce
99edee7
596a65c
edabd7e
2d70af8
72db9d0
1b59ada
9504c89
eb88f7b
c5515f4
471fe85
0ea985a
b0d82f7
cf22b3e
74da50a
819f1d2
984256e
da55007
ef63070
2a7b1de
4b14a00
d06b76a
d600947
60e6aa3
cbec91e
e03521f
723f946
bc22ee1
defc909
efd9702
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 |
---|---|---|
@@ -1,13 +1,24 @@ | ||
import React from "react"; | ||
|
||
import Heading from "./components/Heading"; | ||
import TouristInfoCards from "./components/TouristInfoCards"; | ||
import Bookings from "./Bookings"; | ||
import Footer from "./components/Footer"; | ||
import "./App.css"; | ||
import Restaurant from "./Restaurant"; | ||
|
||
const App = () => { | ||
const address = [ | ||
"123 Fake Street, London, E1 4UD", | ||
"[email protected]", | ||
"0123 456789", | ||
]; | ||
return ( | ||
<div className="App"> | ||
<header className="App-header">CYF Hotel</header> | ||
<Heading /> | ||
<TouristInfoCards /> | ||
<Bookings /> | ||
<Restaurant /> | ||
<Footer address = {address}/> | ||
</div> | ||
); | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import React from "react"; | ||
import React, {useState} from 'react'; | ||
import Search from "./Search.js"; | ||
import SearchResults from "./components/SearchResults.jsx"; | ||
|
||
// import SearchResults from "./SearchResults.js"; | ||
// import FakeBookings from "./data/fakeBookings.json"; | ||
import FakeBookings from "./data/fakeBookings.json"; | ||
|
||
const Bookings = () => { | ||
const [bookings, setBookings] = useState(FakeBookings); | ||
const search = searchVal => { | ||
console.info("TO DO!", searchVal); | ||
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. Looking forward to seeing how you will implement this! |
||
}; | ||
|
@@ -12,7 +15,7 @@ const Bookings = () => { | |
<div className="App-content"> | ||
<div className="container"> | ||
<Search search={search} /> | ||
{/* <SearchResults results={FakeBookings} /> */} | ||
<SearchResults results={bookings} /> | ||
</div> | ||
</div> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import React from "react"; | ||
import Order from "./components/Order"; | ||
|
||
const Restaurant = () => { | ||
const pizzas = 0; | ||
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. How are you looking to implement the restaurant component? Looks like for right now you are only getting the header and the ordertypes |
||
|
||
return ( | ||
<div> | ||
<div className="restaurant-orders"> | ||
<h3>Restaurant Orders</h3> | ||
<ul> | ||
<li> | ||
Pizzas: {pizzas} <button className="btn btn-primary">Add</button> | ||
</li> | ||
<Order orderType="Pizzas" /> | ||
<Order orderType="Salads" /> | ||
<Order orderType="Chocolate cake" /> | ||
</ul> | ||
</div> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from "react"; | ||
|
||
const Footer = (props) => { | ||
return ( | ||
<footer className="footer"> | ||
<ul className="footer-ul"> | ||
{props.address.map((element, index) => { | ||
return <li className="footer-list" key={index}>{element}</li>; | ||
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 use of map! this looks very good |
||
})} | ||
</ul> | ||
</footer> | ||
); | ||
}; | ||
|
||
export default Footer; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import react from "react"; | ||
|
||
function Heading() { | ||
return ( | ||
<header className="App-header"> | ||
<img | ||
src="https://images.unsplash.com/photo-1564501049412-61c2a3083791?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1932&q=80" | ||
alt="logo" | ||
/> | ||
<h1>CYF Hotel</h1> | ||
</header> | ||
); | ||
} | ||
|
||
export default Heading; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React, { useState } from "react"; | ||
import RestaurantButton from "./RestaurantButton"; | ||
|
||
const Order = ({orderType}) => { | ||
const [orders, setOrders] = useState(0); | ||
const orderOne = () => { | ||
setOrders((orders) => orders + 1); | ||
}; | ||
return ( | ||
<li> | ||
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. so because this is all wrapped in |
||
{orderType}: {orders} | ||
<RestaurantButton orderOne={orderOne} /> | ||
</li> | ||
); | ||
}; | ||
|
||
export default Order; |
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. Love that you have the restaurantbutton css in its own file! Very clean and easy to read :) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.restaurant-orders { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
margin: 6rem; | ||
} | ||
|
||
.btn { | ||
margin: 1.5rem 2rem; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import "./RestaurantButton.css"; | ||
const RestaurantButton = ({ orderOne }) => { | ||
return ( | ||
<button className="btn btn-primary" onClick={orderOne}> | ||
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. The button looks good! Time to add the reset button ;) |
||
Add | ||
</button> | ||
); | ||
}; | ||
|
||
export default RestaurantButton; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from "react"; | ||
|
||
const SearchButton = () => { | ||
return <button className="btn btn-primary">Search</button>; | ||
}; | ||
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. Search button is nicely implemented! Looks like you still need to work on the search functionality though :) |
||
|
||
export default SearchButton; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from "react"; | ||
import moment from "moment"; | ||
|
||
const SearchResults = (props) => { | ||
return ( | ||
<table className="table table-bordered"> | ||
<thead> | ||
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. Got to love bootstrap! The table looks good and very well formatted. Good work! |
||
<tr> | ||
<th scope="col">Id</th> | ||
<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">Check in date</th> | ||
<th scope="col">Check out date</th> | ||
<th scope="col">Number of nights</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{props.results.map((result, index) => { | ||
const a = moment(result.checkOutDate); | ||
const b = moment(result.checkInDate); | ||
const days = a.diff(b, "days"); // 1 | ||
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. Really good implementation for the days good job creating the two consts and using diff |
||
return ( | ||
<tr key={index}> | ||
<td>{result.id}</td> | ||
<td>{result.title}</td> | ||
<td>{result.firstName}</td> | ||
<td>{result.surname}</td> | ||
<td>{result.email}</td> | ||
<td>{result.roomId}</td> | ||
<td>{result.checkInDate}</td> | ||
<td>{result.checkOutDate}</td> | ||
<td>{days}</td> | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
</table> | ||
); | ||
}; | ||
|
||
export default SearchResults; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import React from "react"; | ||
|
||
const TouristInfoCards = () => { | ||
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. Good job pulling this out into its own component |
||
|
||
return ( | ||
<div className="cards-container"> | ||
<div className="card"> | ||
<img | ||
src="https://peoplemakeglasgow.com/imager/general/86786/Kelvingrove-Art-Gallery-and-Museum_8dc3bdbc8660ad389ec95cdf9b15d797.jpg" | ||
className="card-img-top" | ||
alt="Picture of Glasgow" | ||
/> | ||
<div className="card-body"> | ||
<h5 className="card-title">Glasgow</h5> | ||
<p className="card-text"> | ||
Glasgow is unique in that many of the city's top museums and | ||
galleries are free-to-visit. Kelvingrove Art Gallery and Museum | ||
and The Burrell Collection are 2 of Scotland's cultural gems, | ||
famed for their world-class cultural collections, as well as their | ||
beautiful parkland settings. | ||
</p> | ||
<a href="peoplemakeglasgow.com" className="btn btn-primary"> | ||
More Information | ||
</a> | ||
</div> | ||
</div> | ||
|
||
<div className="card"> | ||
<img | ||
src="https://eu-assets.simpleview-europe.com/manchester2016/imageresizer/?image=%2Fdmsimgs%2FConwy_Harbour_22481198.jpg&action=ProductDetailFullWidth2" | ||
className="card-img-top" | ||
alt="Picture of Manchester" | ||
/> | ||
<div className="card-body"> | ||
<h5 className="card-title">Manchester</h5> | ||
<p className="card-text"> | ||
Manchester is a major city in the northwest of England with a rich | ||
industrial heritage. The Castlefield conservation area’s | ||
18th-century canal system recalls the city’s days as a textile | ||
powerhouse, and visitors can trace this history at the interactive | ||
Museum of Science & Industry. The revitalised Salford Quays | ||
dockyards now house the Daniel Libeskind-designed Imperial War | ||
Museum North and the Lowry cultural centre. | ||
</p> | ||
<a href="https://www.visitmanchester.com/" className="btn btn-primary"> | ||
More Information | ||
</a> | ||
</div> | ||
</div> | ||
<div className="card"> | ||
<img | ||
src="https://cdn-lnp.dataweavers.io/-/media/images/london/visit/whats-on/event-pages/buckinghampalace1920x1080.jpg?rev=c88f581f5aa2444f97f3343f60008663?mw=640&hash=52C77C542B4531A72B120C5586046410" | ||
className="card-img-top" | ||
alt="Picture of London" | ||
/> | ||
<div className="card-body"> | ||
<h5 className="card-title">London</h5> | ||
<p className="card-text"> | ||
Welcome to London! Discover the best of London with Visit London, | ||
the official guide to England’s exciting capital. Find things to | ||
do in London, from iconic sightseeing spots and fun-filled days | ||
out to top restaurants, theatre and unmissable London events. If | ||
you’re not able to visit just yet, plan ahead to make the most of | ||
your next visit. | ||
</p> | ||
<a href="https://www.visitlondon.com/" className="btn btn-primary"> | ||
More Information | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default TouristInfoCards; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,8 @@ body { | |
.search-row input { | ||
margin-right: 10px; | ||
} | ||
|
||
/* making space between logo and h1 */ | ||
header > img { | ||
margin-right: 2rem; | ||
} | ||
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. Is there a reason to have this in the index.css? Remember for index.css this would be to change the whole project. |
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.
Nice organization and adding all the components into the app.js