This repository was archived by the owner on Feb 9, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 761
London 10 | Abubakar-Meigag | React | react-hotel-project #610
Open
Abubakar-Meigag
wants to merge
35
commits into
CodeYourFuture:master
Choose a base branch
from
Abubakar-Meigag:for-review
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
0654bfb
create separate new component
Abubakar-Meigag dc85b84
update exercise 2
Abubakar-Meigag 78c4fda
update for exercise 3
Abubakar-Meigag d00ce97
update exercise 4
Abubakar-Meigag 58454be
update SearchButton
Abubakar-Meigag c767a81
update exercise 5 done
Abubakar-Meigag 38e75eb
ok
Abubakar-Meigag 1007dc4
css and article update
Abubakar-Meigag 2b3ccef
update exercise 6 - 7
Abubakar-Meigag b3ffaae
update for exercise 8 done
Abubakar-Meigag ff8e18d
update exercise 9 done
Abubakar-Meigag 77ee7f8
update exercise 10 done
Abubakar-Meigag 6dd2601
update exercise 11
Abubakar-Meigag 1d0d555
update for #12 & #13 exercise done
Abubakar-Meigag 4c310a0
update 14 done
Abubakar-Meigag 8cedfa2
update exercise 15 done
Abubakar-Meigag 3b5dc26
update booking for exercise 16
Abubakar-Meigag 607445b
update done exercise 17
Abubakar-Meigag 4c6a7f6
correctly passed key - for review comment
Abubakar-Meigag 42b5fd2
fix bug
Abubakar-Meigag 32c9651
Update FooterCompo.js
Abubakar-Meigag e38bd4e
fix bug
Abubakar-Meigag 37fbcfa
Update FooterCompo.js
Abubakar-Meigag 4820eae
add id to test code smell check if it is only on new code
Abubakar-Meigag 81a1fbe
change for test
Abubakar-Meigag 3087b39
update for fix comment
Abubakar-Meigag ccff99f
exercise 18 done
Abubakar-Meigag a8a4a15
exercise 19 done
Abubakar-Meigag 1d82554
update
Abubakar-Meigag 7da0972
exercise 20 done
Abubakar-Meigag 27593cb
update done until exercise 21
Abubakar-Meigag c6c77f4
fix for fetch problem
Abubakar-Meigag 54bd53d
exercise 22 done
Abubakar-Meigag 65729ea
update
Abubakar-Meigag 11a218d
update
Abubakar-Meigag File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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,15 +1,30 @@ | ||
| import React from "react"; | ||
|
|
||
| import Heading from "./Heading"; | ||
| import Bookings from "./Bookings"; | ||
| import Restaurant from "./Restaurant"; | ||
| import TouristInfoCards from "./TouristInfoCards"; | ||
| import FooterCompo from "./FooterCompo"; | ||
| import "./App.css"; | ||
|
|
||
| const App = () => { | ||
| return ( | ||
| <div className="App"> | ||
| <header className="App-header">CYF Hotel</header> | ||
| <Bookings /> | ||
| <Heading /> | ||
| <TouristInfoCards /> | ||
| <Bookings name /> | ||
| <Restaurant /> | ||
| <FooterCompo | ||
| details={ | ||
| { | ||
| address: "123 Fake Street, London, E1 4UD", | ||
| email: "hello@fakehotel.com", | ||
| phone: "0123 456789", | ||
| } | ||
| } | ||
| /> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default App; | ||
|
|
This file contains hidden or 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,21 +1,47 @@ | ||
| import React from "react"; | ||
| import React, { useCallback, useEffect, useState } from "react"; | ||
| import Axios from "axios"; | ||
| import Search from "./Search.js"; | ||
| // import SearchResults from "./SearchResults.js"; | ||
| import SearchResults from "./SearchResults.js"; | ||
| // import FakeBookings from "./data/fakeBookings.json"; | ||
|
|
||
| const Bookings = () => { | ||
| const search = searchVal => { | ||
| const [bookings, setBookings] = useState([]); | ||
| const [searchVal, setSearchVal] = useState(""); | ||
| const [loading, setLoading] = useState(false); | ||
|
|
||
| const search = (searchVal) => { | ||
| console.info("TO DO!", searchVal); | ||
| setSearchVal(searchVal); | ||
| }; | ||
|
|
||
| useEffect(() => { | ||
| const fetchData = async () => { | ||
| try { | ||
| const res = await Axios.get("https://cyf-react.glitch.me/delayed"); | ||
| setBookings(res.data); | ||
| } catch (error) { | ||
| console.log(error); | ||
| } | ||
| setLoading(true); | ||
| } | ||
| fetchData(); | ||
|
|
||
| }, []); | ||
|
|
||
| const searchOutCome = bookings.filter( | ||
| (el) => el.firstName.includes(searchVal) || el.surname.includes(searchVal) | ||
| ); | ||
|
|
||
| return ( | ||
| <div className="App-content"> | ||
| <div className="container"> | ||
| <Search search={search} /> | ||
| {/* <SearchResults results={FakeBookings} /> */} | ||
| <Search search={search} /> | ||
| {!loading ? (<h1>Loading...</h1>) : ( | ||
| <SearchResults results={searchOutCome} /> ) | ||
| } | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default Bookings; | ||
| export default Bookings; |
This file contains hidden or 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,35 @@ | ||
| // import Axios from 'axios'; | ||
| import React, { useEffect, useState } from "react"; | ||
|
|
||
| const CustomerProfile = (props) => { | ||
| const [showDataProfile, setShowDataProfile] = useState(""); | ||
| const idApi = `https://cyf-react.glitch.me/customers/${props.id}`; | ||
|
|
||
| useEffect(() => { | ||
| if (props.id) { | ||
| fetch(idApi) | ||
| .then((response) => response.json()) | ||
| .then((data) => setShowDataProfile(data)); | ||
| } | ||
| }, [props.id]); | ||
| return ( | ||
| <div className="customer-profile"> | ||
| {props.id !== "" ? <h1> Customer Profile</h1> : <></>} | ||
| {props.id !== "" ? ( | ||
| <ul> | ||
| <li>Id: {showDataProfile.id}</li> | ||
| <li>Vip: {showDataProfile.vip ? "Yes" : "No"}</li> | ||
| <li> | ||
| Full Name: {showDataProfile.firstName} {showDataProfile.surname} | ||
| </li> | ||
| <li>Email: {showDataProfile.email}</li> | ||
| <li>Phone no: {showDataProfile.phoneNumber}</li> | ||
| </ul> | ||
| ) : ( | ||
| <></> | ||
| )} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default CustomerProfile; |
This file contains hidden or 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,17 @@ | ||
| import React from "react"; | ||
|
|
||
| const FooterCompo = ({ details }) => { | ||
| return ( | ||
| <div className="footer"> | ||
| <footer> | ||
| <ul> | ||
| {Object.keys(details).map((key) => { | ||
| return <li key={key}>{details[key]}</li>; | ||
| })} | ||
| </ul> | ||
| </footer> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default FooterCompo; |
This file contains hidden or 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"; | ||
| import logoHotel from "./images/495.jpg"; | ||
|
|
||
| const Heading = () => { | ||
| const name = "Beko CYF Luxury Hotel"; | ||
| return ( | ||
| <div> | ||
| <header className="App-header"> | ||
| <h1>{name}</h1> | ||
| <img src={logoHotel} className="App-logo" /> | ||
| </header> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default Heading; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Really nice that you've started learning about
axios👍Not a good practice to push dependencies, can you do a bit of study on how to manage dependencies and exclude them from version control using Git.