Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1d9cf63
created footer and rendered it to the bottom of the page
areebsattar Feb 26, 2024
51cdf47
Merge pull request #30 from areebsattar/Footer
nazaninsaedi Feb 26, 2024
bfa8aca
Import the SearchButton component into Search file
OrlandoMoralesKuan Feb 26, 2024
33c1cce
feature card
Sabella-8 Feb 26, 2024
205be45
feature-deck
Sabella-8 Feb 26, 2024
8e63c39
card
Sabella-8 Feb 26, 2024
6219d16
feature-card
Sabella-8 Feb 26, 2024
777809c
Merge branch 'main' into feature-card
areebsattar Feb 26, 2024
0b247dd
Merge pull request #32 from areebsattar/feature-card
areebsattar Feb 26, 2024
747b76a
feature-deck
Sabella-8 Feb 27, 2024
d35bbef
fixing the SearchButton component
OrlandoMoralesKuan Feb 27, 2024
370e52a
Merge branch 'main' of https://github.com/areebsattar/React-Module-Pr…
OrlandoMoralesKuan Feb 27, 2024
1bb601a
Merge pull request #31 from areebsattar/FeatureSearchButton
Sabella-8 Feb 27, 2024
f2268af
MERGINING DECK
Sabella-8 Feb 27, 2024
43e1179
search-results up to email
Sabella-8 Feb 28, 2024
2f15a89
adding room id, check in date and check out date
OrlandoMoralesKuan Feb 28, 2024
5d8a11b
erasing changes
OrlandoMoralesKuan Feb 28, 2024
08739f1
adding room id, check in date and check out date in tablehead.jsx file
OrlandoMoralesKuan Feb 28, 2024
5ca2999
adding room id, check in date and check out date in tableBody.jsx
OrlandoMoralesKuan Feb 28, 2024
3c7ff9d
adding roomId, checkInDate and checkOutDate in SearchResult.jsx
OrlandoMoralesKuan Feb 28, 2024
fd0ddb3
changing the lowercase t to capital letter T in TabeleHead
OrlandoMoralesKuan Feb 28, 2024
da0bae0
Rename the TableHead file
OrlandoMoralesKuan Feb 28, 2024
c9c08cf
Merge branch 'main' into feature-deck
areebsattar Feb 28, 2024
774add5
Merge pull request #33 from areebsattar/feature-deck
areebsattar Feb 28, 2024
7cba66c
Merge branch 'main' into search-results
areebsattar Feb 28, 2024
c75143d
Merge pull request #34 from areebsattar/search-results
areebsattar Feb 28, 2024
b4aeabf
Fixed error related to Deck after merging
areebsattar Feb 28, 2024
594162b
Added the column to calculate the total nights of stay
areebsattar Mar 1, 2024
48b962f
adding div with class to App.jsx, adding css to App.scss, adding a cl…
OrlandoMoralesKuan Mar 1, 2024
766836a
Merge pull request #35 from areebsattar/FeatureCalculateDuration
Sabella-8 Mar 3, 2024
2897bbf
create new branch FeatureRestaurant
OrlandoMoralesKuan Mar 3, 2024
880c4c3
change done to restore the webpage
OrlandoMoralesKuan Mar 3, 2024
e5bc6fa
Rendering the Restaurant Component in App.jsx
OrlandoMoralesKuan Mar 3, 2024
62a1aa4
Merge pull request #36 from areebsattar/FeatureRestaurant
Sabella-8 Mar 3, 2024
d88461e
Working in the Restaurant component
OrlandoMoralesKuan Mar 3, 2024
2954242
Adding the function restaurant and buttonAdd to increase the number o…
OrlandoMoralesKuan Mar 3, 2024
4fa785a
Adding margin bottom to the section restaurant in the App.scss file
OrlandoMoralesKuan Mar 3, 2024
d81e223
Merge pull request #37 from areebsattar/FeatureRestaurantState
Sabella-8 Mar 5, 2024
25da0c4
feature booking state Done
nazaninsaedi Mar 5, 2024
9eb31cf
FeatureBookingsStateDone
nazaninsaedi Mar 5, 2024
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
6 changes: 6 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"test:watch": "vitest"
},
"dependencies": {
"dayjs": "^1.11.10",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
25 changes: 22 additions & 3 deletions src/components/App/App.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
import Bookings from "@/components/Bookings/Bookings.jsx";
import "./App.scss";
import Footer from "../Footer/Footer";
import Deck from "../Deck/Deck";
import AppHeader from "../AppHeader/AppHeader";
import Restaurant from "../Restaurant/Restaurant";

const App = () => (
<div className="app">
<header className="app__header">
<h1 className="app__heading">CYF Hotel</h1>
</header>
<div className="header">
<header className="app__header">
<h1 className="app__heading">CYF Hotel</h1>
</header>
<AppHeader />
</div>
<Bookings />
<Restaurant />

<Deck />

<Footer
details={[
"123 Fake Street, London, E1 4UD",
"hello@fakehotel.com",
"0123 456789",
]}
className="footer"
/>
</div>
);

Expand Down
23 changes: 21 additions & 2 deletions src/components/App/App.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
.app {
}
.app {
display: grid;
grid-template-rows: auto 1fr auto; /* Set up three rows - header, content, footer */
max-width: var(--space--container);
margin: auto;
padding: var(--space--gap);
min-height: 100vh; /* Ensure the container takes at least the full height of the viewport */
}

.app__header {
background-color: var(--color--paper);
padding: var(--space--m);
}

.app__heading {
margin: 0;
margin-top: 30%;
}

.restaurant {
margin-bottom: 20px;
}

.footer {
background-color: var(--color--paper);
padding: var(--space--m);
}
10 changes: 4 additions & 6 deletions src/components/AppHeader/AppHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// import Logo from "@/assets/spa-logo.png";
// import "./AppHeader.scss";
// const AppHeader = () => (
// what goes in here? there is no content in the AppHeader component
// );
// export default AppHeader;
import Logo from "@/assets/spa-logo.png";
import "./AppHeader.scss";
const AppHeader = () => <img className="LogoImg" src={Logo}></img>;
export default AppHeader;
13 changes: 13 additions & 0 deletions src/components/AppHeader/AppHeader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,16 @@
max-width: 100px;
}
}

.header {
margin-right: 35%;
margin-left: 35%;
display: flex;
flex-direction: row-reverse;
justify-content: space-evenly;
}

.LogoImg {
height: 150px;
width: 150px;
}
9 changes: 8 additions & 1 deletion src/components/Bookings/Bookings.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import React, { useState } from 'react';
import Search from "@/components/Search/Search";
import SearchResult from "../SearchResult/SearchResult";
import FakeBookings from '@/data/fakeBookings.json';

// import SearchResults from "@/componentsSearchResults.js";
// import FakeBookings from "@/data/fakeBookings.json";

const Bookings = () => {

const [bookings, setBookings] = useSatet(FakeBookings);

const search = (searchVal) => {
console.info("TO DO!", searchVal);
};

return (
<main className="bookings">
<Search search={search} />
{/* <SearchResults results={FakeBookings} /> */}
<SearchResult bookings={bookings} />
</main>
);
};
Expand Down
12 changes: 6 additions & 6 deletions src/components/Bookings/Bookings.test.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { describe, it, expect } from "vitest";
import { render, screen } from "@testing-library/react";
import Bookings from "./Bookings.jsx";
import { describe, it, expect } from 'vitest';
import { render, screen } from '@testing-library/react';
import Bookings from './Bookings.jsx';

describe("Bookings Component", () => {
it("renders a main element", () => {
describe('Bookings Component', () => {
it('renders a main element', () => {
render(<Bookings />);
const mainElement = screen.getByRole("main");
const mainElement = screen.getByRole('main');
expect(mainElement).toBeInTheDocument();
});
});
21 changes: 15 additions & 6 deletions src/components/Card/Card.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
// import "./Card.scss";
import React from "react";
import "./Card.scss";

// const Card = ({ title, url, image }) => {
// return (
const Card = (props) => {
const { title, url, image } = props;
return (
<div className="card">
<h2>{title}</h2>
<img src={image} alt={title} />

// );
// };
<a href={url}> {title}</a>

// export default Card;

</div>
);
};

export default Card;
27 changes: 18 additions & 9 deletions src/components/Deck/Deck.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
// import Card from "@/components/Card/Card";
// import "./Deck.scss";
// import cardsData from "@/data/fakeCards.json";
import Card from "@/components/Card/Card";
import "./Deck.scss";
import cardsData from "@/data/fakeCards.json";

// const Deck = () => {
// you will need to map over the cardsData array and render a Card component for each card object
// how will you pass props to the Card component?
const Deck = (props) => {
return (
<div className="deck">
{cardsData.map((city, index) => (
<Card
key={index}
title={city.title}
url={city.url}
image={city.image}
/>
))}
</div>
);
};

// };

// export default Deck;
export default Deck;
16 changes: 16 additions & 0 deletions src/components/Footer/Footer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";
import "./Footer.scss"

export default function Footer(props) {
return (
<>
<footer>
<ul>
{props.details.map((detail, id) => (
<li key={id}>{detail}</li>
))}
</ul>
</footer>
</>
);
}
5 changes: 5 additions & 0 deletions src/components/Footer/Footer.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.footer {
margin-top: auto;
background-color: var(--color--paper);
padding: var(--space--m);
}
17 changes: 13 additions & 4 deletions src/components/Restaurant/Restaurant.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
const Restaurant = () => {
const pizzas = 0;
import { useState } from "react";

function Restaurant() {
const [pizzas, setPizzas] = useState(0);

function buttonAdd() {
setPizzas(pizzas + 1);
}

return (
<section className="restaurant">
<h3 className="restaurant__heading">Restaurant Orders</h3>
<ul className="restaurant__list">
<li className="restaurant__item">
Pizzas: {pizzas}{" "}
<button className="button restaurant__button">Add</button>
<button className="button restaurant__button" onClick={buttonAdd}>
Add
</button>
</li>
</ul>
</section>
);
};
}

export default Restaurant;
3 changes: 2 additions & 1 deletion src/components/Search/Search.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "./Search.scss";
import SearchButton from "../SearchButton/SearchButton";

const Search = () => (
<section className="search">
Expand All @@ -15,7 +16,7 @@ const Search = () => (
className="search__input"
placeholder="Customer name"
/>
<button className="button search__button">Search</button>
<SearchButton />
</form>
</section>
);
Expand Down
6 changes: 6 additions & 0 deletions src/components/SearchButton/SearchButton.jsx
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
import React from "react";

const SearchButton = () => {
return <button className="button search__button">Search</button>;
};

export default SearchButton;
42 changes: 42 additions & 0 deletions src/components/SearchResult/SearchResult.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import "./SearchResult.scss";
import FakeBookings from "@/data/fakeBookings.json";
import TableBody from "./TableBody";
import TableHead from "./TableHead";
import dayjs from "dayjs";

const Bookings = FakeBookings;
function SearchResult() {
return (
<table>
<thead>
<TableHead />
</thead>
<tbody>
{Bookings.map((book) => {
const stayNightsTotal = dayjs(book.checkOutDate).diff(
dayjs(book.checkInDate),
"day"
);
return (
<>
<TableBody
key={book.id}
id={book.id}
title={book.title}
firstName={book.firstName}
surName={book.surname}
email={book.email}
roomId={book.roomId}
checkInDate={book.checkInDate}
checkOutDate={book.checkOutDate}
stayNights={stayNightsTotal}
/>
</>
);
})}
</tbody>
</table>
);
}
export default SearchResult;
console.log(SearchResult());
19 changes: 19 additions & 0 deletions src/components/SearchResult/SearchResult.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
table {
border-collapse: collapse;
width: 100%;
}

thead {
background-color: #f2f2f2;
}

th,
td {
padding: 8px;
text-align: left;
border-bottom: 1px solid #ddd;
}

th {
font-weight: bold;
}
33 changes: 33 additions & 0 deletions src/components/SearchResult/TableBody.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// import FakeBookings from "@/data/fakeBookings.json";

function TableBody(props) {
let {
id,
title,
name,
firstName,
surName,
email,
roomId,
checkInDate,
checkOutDate,
stayNights,
} = props;
return (
<>
<tr key={id}>
<td>{id}</td>
<td>{title}</td>
<td>{firstName}</td>
<td>{surName}</td>
<td>{email}</td>
<td>{roomId}</td>
<td>{checkInDate}</td>
<td>{checkOutDate}</td>
<td>{stayNights}</td>
</tr>
</>
);
}

export default TableBody;
Loading