This repository has been archived by the owner on Feb 9, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 768
London10 | Adrian Ilovan | cyf-hotel-react #589
Open
AdrianIlovan
wants to merge
27
commits into
CodeYourFuture:master
Choose a base branch
from
AdrianIlovan:london10/ai
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
27 commits
Select commit
Hold shift + click to select a range
eed0a04
Lesson1/####1. Done
AdrianIlovan bf1879b
####2 Done
AdrianIlovan 55b8b8d
####3 Done
AdrianIlovan 8660d90
###4 Updates
AdrianIlovan 0a1bf85
Lesson1/#4 Done
AdrianIlovan 8dee235
lesson1/####4 Done!
AdrianIlovan 322bf6d
Lesson1/#5 Done
AdrianIlovan 20e65f2
Lesson1/#6 Done
AdrianIlovan 1d5a9e9
Lesson 1/#7 Done
AdrianIlovan a69f36b
Lesson2/ task 1 Done
AdrianIlovan a94bc9a
Lesson 2/task 9 Done
AdrianIlovan 59d6f5a
L 2/ T 10 Done
AdrianIlovan 710c5bd
L2/T11 Done
AdrianIlovan 95e9db2
L2/12 Done
AdrianIlovan 7050966
Lesson2/13 Done
AdrianIlovan a763ffe
Level2/14 Done
AdrianIlovan 70349ea
Lesson2 Done Week 2
AdrianIlovan 569896c
L3 / 16 Done API
AdrianIlovan f65a9ff
L3/17 Done
AdrianIlovan 84b0df2
Update L3/2
AdrianIlovan 5bc3c7c
L3/18 Done
AdrianIlovan 6656614
L3/19 Done
AdrianIlovan 9aaf351
L3/20 done
AdrianIlovan 57fe0bd
L3/21 Done
AdrianIlovan b857ed1
L3/22 Done
AdrianIlovan b437ec6
L3 Done
AdrianIlovan 41bc53a
L3 Done last Update
AdrianIlovan 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 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 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 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,44 @@ | ||
import React, { useEffect, useState } from "react"; | ||
|
||
const CostumerProfile = ({id}) => { | ||
|
||
const [costumerProfile, setCostumerProfile] = useState(null) | ||
|
||
useEffect(() => { | ||
const fetchCostumerProfile = async () => { | ||
try { | ||
const res = await fetch(`https://cyf-react.glitch.me/customers/${id}`); | ||
const data = await res.json(); | ||
setCostumerProfile(data); | ||
} catch (error) { | ||
console.error("Error fetching Costumer Profile:", error); | ||
} | ||
}; | ||
if (id) { | ||
fetchCostumerProfile(); | ||
} | ||
}, [id]); | ||
|
||
if (!id) { | ||
return null; | ||
} | ||
|
||
return( | ||
<div> | ||
{costumerProfile ? ( | ||
<div> | ||
<h1>Costumer Profile {id}</h1> | ||
<ul> | ||
<li>Email: {costumerProfile.email}</li> | ||
<li>VIP: {costumerProfile.vip ? "Yes" : "No"}</li> | ||
<li>Phone Number: {costumerProfile.phoneNumber}</li> | ||
</ul> | ||
</div> | ||
) : ( | ||
<p>Loading Costumer Profile...</p> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default CostumerProfile; |
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 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; |
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 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; |
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,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; |
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,14 @@ | ||
import React, { useState } from "react"; | ||
|
||
const RestaurantButton = ({ onClick }) => { | ||
return ( | ||
<button className="btn btn-primary" | ||
onClick={onClick} >Add</button> | ||
) | ||
|
||
|
||
} | ||
|
||
|
||
export default RestaurantButton; | ||
|
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,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; |
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.
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 :)