-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
491097c
commit 396ec20
Showing
20 changed files
with
1,409 additions
and
51 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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,14 @@ | ||
import React from 'react'; | ||
import { Link, useParams } from 'react-router-dom'; | ||
|
||
const Book = () => { | ||
const {bedType} = useParams(); | ||
return ( | ||
<div style={{textAlign: 'center'}}> | ||
<h1>Let's book a {bedType} Room.</h1> | ||
<p>Want a <Link to="/home">different room?</Link> </p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Book; |
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,28 @@ | ||
.header{ | ||
border: 4px solid black; | ||
height: 300px; | ||
background-position: center center; | ||
background-size: 100% 100%; | ||
} | ||
.header .logo{ | ||
height: 50px; | ||
} | ||
.title-container{ | ||
color: rgba(255, 255, 255, 0.699); | ||
text-align: center; | ||
font-size: 2em; | ||
} | ||
.nav{ | ||
margin-left: 200px; | ||
} | ||
.nav li{ | ||
display: inline; | ||
margin-left: 50px; | ||
|
||
} | ||
|
||
.nav a{ | ||
text-decoration: none; | ||
color: rgba(255, 255, 255, 0.877); | ||
font-weight: bold; | ||
} |
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,34 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import './Header.css'; | ||
import header from '../../images/header.png'; | ||
import logo from '../../images/icons/logo.png'; | ||
|
||
const Header = () => { | ||
return ( | ||
<div style={{ backgroundImage: `linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(${header})` }} className="header"> | ||
<nav className="nav"> | ||
<ul> | ||
<li> | ||
<img className="logo" src={logo} alt=""/> | ||
</li> | ||
<li> | ||
<Link to="/home">Home</Link> | ||
</li> | ||
<li> | ||
<Link to="/login">Login</Link> | ||
</li> | ||
<li> | ||
<Link className="btn-book" to="/book">Book</Link> | ||
</li> | ||
</ul> | ||
</nav> | ||
<div className="title-container"> | ||
<h1>Burj Al Arab</h1> | ||
<h2>A global icon of Arabian luxury</h2> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Header; |
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,51 @@ | ||
import React from 'react'; | ||
import Room from '../Room/Room'; | ||
|
||
const Home = () => { | ||
const style = { | ||
display: 'flex', | ||
margin: '40px', | ||
justifyContent: 'space-between' | ||
} | ||
const rooms = [ | ||
{ | ||
title: 'Standard Single Room', | ||
description: 'Standard Single Rooms are designed in open -concept living area and have many facilities.', | ||
imgUrl: 'https://cdn.jumeirah.com/-/mediadh/dh/hospitality/jumeirah/offers/offer-images/burj-al-arab-presidential-suite-living-room-4-hero.jpg', | ||
bed: 1, | ||
capacity: 1, | ||
bedType: 'Single', | ||
avatar: 'S', | ||
price: 119 | ||
}, | ||
{ | ||
title: 'Couple Power Room', | ||
description: 'Superior Double Rooms are perfectly equipped for traveling couples or friends.', | ||
imgUrl: 'https://cdn.jumeirah.com/-/mediadh/dh/hospitality/jumeirah/offers/offer-images/burj-al-arab-royal-suite-staircase-5-hero.jpg', | ||
bed: 1, | ||
capacity: 2, | ||
bedType: 'Double', | ||
avatar: 'D', | ||
price: 149 | ||
}, | ||
{ | ||
title: 'Family Capacity Room', | ||
description: ' Have lots of in-room facilities and are designed in open-concept living area.', | ||
imgUrl: 'https://cdn.jumeirah.com/-/mediadh/dh/hospitality/jumeirah/hotels/dubai/burj-al-arab-jumeirah/room/presidential-two-bedroom-suite/burj-al-arab-presidential-suite-guest-bedroom_6-4_landscape/burj-al-arab-presidential-suite-guest-bedroom_16-9_landscape.jpg?w=2080', | ||
bed: 2, | ||
capacity: 4, | ||
bedType: 'Family', | ||
avatar: 'F', | ||
price: 199 | ||
} | ||
] | ||
return ( | ||
<div style={style}> | ||
{ | ||
rooms.map(room => <Room key={room.bedType} room={room}></Room>) | ||
} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Home; |
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,39 @@ | ||
import React, { useContext } from 'react'; | ||
import * as firebase from "firebase/app"; | ||
import "firebase/auth"; | ||
import firebaseConfig from './firebase.config'; | ||
import {UserContext} from '../../App'; | ||
import { useHistory, useLocation } from 'react-router-dom'; | ||
|
||
const Login = () => { | ||
const [loggedInUser, setLoggedInUser] = useContext(UserContext); | ||
const history = useHistory(); | ||
const location = useLocation(); | ||
const { from } = location.state || { from: { pathname: "/" } }; | ||
|
||
if(firebase.apps.length === 0){ | ||
firebase.initializeApp(firebaseConfig); | ||
} | ||
|
||
const handleGoogleSignIn = () => { | ||
var provider = new firebase.auth.GoogleAuthProvider(); | ||
firebase.auth().signInWithPopup(provider).then(function(result) { | ||
const {displayName, email} = result.user; | ||
const signedInUser = {name: displayName, email} | ||
setLoggedInUser(signedInUser); | ||
history.replace(from); | ||
// ... | ||
}).catch(function(error) { | ||
const errorMessage = error.message; | ||
console.log(errorMessage); | ||
}); | ||
} | ||
return ( | ||
<div> | ||
<h1>This is Login</h1> | ||
<button onClick={handleGoogleSignIn}>Google Sign in</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Login; |
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 @@ | ||
const firebaseConfig = { | ||
apiKey: "AIzaSyAsihSADFnF_FoZ6je8p1W9lilyqX7cHWQ", | ||
authDomain: "burj-al-arab.firebaseapp.com", | ||
databaseURL: "https://burj-al-arab.firebaseio.com", | ||
projectId: "burj-al-arab", | ||
storageBucket: "burj-al-arab.appspot.com", | ||
messagingSenderId: "244522202387", | ||
appId: "1:244522202387:web:f3801d0588387140e1d6e6" | ||
}; | ||
export default firebaseConfig; |
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,26 @@ | ||
import React, { useContext } from 'react'; | ||
import { Redirect, Route } from 'react-router-dom'; | ||
import { UserContext } from '../../App'; | ||
|
||
const PrivateRoute = ({ children, ...rest }) => { | ||
const [loggedInUser, setLoggedInUser] = useContext(UserContext); | ||
return ( | ||
<Route | ||
{...rest} | ||
render={({ location }) => | ||
loggedInUser.email ? ( | ||
children | ||
) : ( | ||
<Redirect | ||
to={{ | ||
pathname: "/login", | ||
state: { from: location } | ||
}} | ||
/> | ||
) | ||
} | ||
/> | ||
); | ||
}; | ||
|
||
export default PrivateRoute; |
Oops, something went wrong.