Skip to content
This repository was archived by the owner on Feb 9, 2024. It is now read-only.
Open
Show file tree
Hide file tree
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 Jun 11, 2023
dc85b84
update exercise 2
Abubakar-Meigag Jun 11, 2023
78c4fda
update for exercise 3
Abubakar-Meigag Jun 12, 2023
d00ce97
update exercise 4
Abubakar-Meigag Jun 13, 2023
58454be
update SearchButton
Abubakar-Meigag Jun 13, 2023
c767a81
update exercise 5 done
Abubakar-Meigag Jun 14, 2023
38e75eb
ok
Abubakar-Meigag Jun 14, 2023
1007dc4
css and article update
Abubakar-Meigag Jun 15, 2023
2b3ccef
update exercise 6 - 7
Abubakar-Meigag Jun 15, 2023
b3ffaae
update for exercise 8 done
Abubakar-Meigag Jun 18, 2023
ff8e18d
update exercise 9 done
Abubakar-Meigag Jun 18, 2023
77ee7f8
update exercise 10 done
Abubakar-Meigag Jun 18, 2023
6dd2601
update exercise 11
Abubakar-Meigag Jun 19, 2023
1d0d555
update for #12 & #13 exercise done
Abubakar-Meigag Jun 20, 2023
4c310a0
update 14 done
Abubakar-Meigag Jun 22, 2023
8cedfa2
update exercise 15 done
Abubakar-Meigag Jun 24, 2023
3b5dc26
update booking for exercise 16
Abubakar-Meigag Jun 29, 2023
607445b
update done exercise 17
Abubakar-Meigag Jun 29, 2023
4c6a7f6
correctly passed key - for review comment
Abubakar-Meigag Jun 30, 2023
42b5fd2
fix bug
Abubakar-Meigag Jun 30, 2023
32c9651
Update FooterCompo.js
Abubakar-Meigag Jul 1, 2023
e38bd4e
fix bug
Abubakar-Meigag Jul 1, 2023
37fbcfa
Update FooterCompo.js
Abubakar-Meigag Jul 1, 2023
4820eae
add id to test code smell check if it is only on new code
Abubakar-Meigag Jul 1, 2023
81a1fbe
change for test
Abubakar-Meigag Jul 1, 2023
3087b39
update for fix comment
Abubakar-Meigag Jul 1, 2023
ccff99f
exercise 18 done
Abubakar-Meigag Jul 1, 2023
a8a4a15
exercise 19 done
Abubakar-Meigag Jul 1, 2023
1d82554
update
Abubakar-Meigag Jul 1, 2023
7da0972
exercise 20 done
Abubakar-Meigag Jul 1, 2023
27593cb
update done until exercise 21
Abubakar-Meigag Jul 3, 2023
c6c77f4
fix for fetch problem
Abubakar-Meigag Jul 7, 2023
54bd53d
exercise 22 done
Abubakar-Meigag Jul 7, 2023
65729ea
update
Abubakar-Meigag Jul 7, 2023
11a218d
update
Abubakar-Meigag Jul 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^1.4.0",
"moment": "^2.29.4",
Copy link

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.

"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "^5.0.1"
Expand Down
108 changes: 97 additions & 11 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,40 +1,126 @@
@import url('https://fonts.googleapis.com/css2?family=Anton&family=Monomaniac+One&family=Quicksand:wght@300&display=swap');

.App {
text-align: left;
}

.rwo-btn {
height: 50px;
width: 88px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
background-color: blue;
color: aliceblue;
font-weight: bolder;
}

.card-img-top {
width: 450px;
height: 301px;
}

.tourist-cards {
margin-top: 10px;
margin-left: 80px;
margin-right: 40px;
display: grid;
grid-template-columns: repeat(3, 1fr);
/* margin-top: 30px;
display: flex;
flex-direction: row;
justify-content: space-between;
padding-left: 40px;
padding-right: 40px; */
}

.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 80px;
/* animation: App-logo-spin infinite 20s linear; */
height: 100px;
margin-bottom: 20px;
border: 1px solid rgb(245, 163, 32)
}

.App-header {
background-color: #222;
height: 50px;
background-color: #272626;
height: 150px;
width: 100%;
padding: 20px;
color: white;
color: rgb(245, 163, 32);
text-align: left;
font-family: Arial, Helvetica, sans-serif;
font-size: 1em;
/* font-family: Arial, Helvetica, sans-serif; */
font-size: 2.8em;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
gap: 30px;
padding-top: 51px;
font-family: 'Monomaniac One', sans-serif;
}

.App-title {
font-size: 1.5em;


.App-header h1{
font-size: 3.3rem;
}

/* .App-title {
font-size: 1.5em;
} */

.App-content {
padding-top: 20px;
font-size: large;
}

.order-type {
display: grid;
grid-template-columns: repeat(4, 1fr);
margin: 0 100px;
}

.card-body {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
}

.row-nonHighlight {
background-color: rgb(241, 239, 237);
}

.row-highlight {
background-color: rgb(245, 163, 32);
}

.order-head {
display: flex;
justify-content: center;
}

.customer-profile {
display: flex;
flex-direction: column;
flex-wrap: wrap;
align-items: center;
background-color: #4c4949;
color: snow;
}


@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}

to {
transform: rotate(360deg);
}
}

.search {
padding: 5px 0 20px 0;
}
Expand All @@ -53,5 +139,5 @@ tr {
}

.card {
width: 18rem;
}
width: 28.2rem;
}
21 changes: 18 additions & 3 deletions src/App.js
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;

38 changes: 32 additions & 6 deletions src/Bookings.js
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;
35 changes: 35 additions & 0 deletions src/CustomerProfile.js
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;
17 changes: 17 additions & 0 deletions src/FooterCompo.js
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;
16 changes: 16 additions & 0 deletions src/Heading.js
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;
Loading