Skip to content

Commit c75143d

Browse files
authored
Merge pull request #34 from areebsattar/search-results
NW6 | Sabella Fisseha | Search results- id, title, name, surname, email
2 parents 774add5 + 7cba66c commit c75143d

7 files changed

Lines changed: 109 additions & 8 deletions

File tree

src/components/App/App.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import "./App.scss";
44
import Deck from "../Deck/Deck";
55

66
import Footer from "../Footer/Footer";
7-
7+
import Deck from "../Deck/Deck";
8+
import AppHeader from "../AppHeader/AppHeader";
89
const App = () => (
910
<div className="app">
1011
<header className="app__header">
1112
<h1 className="app__heading">CYF Hotel</h1>
1213
</header>
14+
<AppHeader />
1315
<Bookings />
1416

1517
<Deck />
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// import Logo from "@/assets/spa-logo.png";
2-
// import "./AppHeader.scss";
3-
// const AppHeader = () => (
4-
// what goes in here? there is no content in the AppHeader component
5-
// );
6-
// export default AppHeader;
1+
import Logo from "@/assets/spa-logo.png";
2+
import "./AppHeader.scss";
3+
const AppHeader = () => <img src={Logo}></img>;
4+
export default AppHeader;

src/components/Bookings/Bookings.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Search from "@/components/Search/Search";
2+
import SearchResult from "../SearchResult/SearchResult";
23
// import SearchResults from "@/componentsSearchResults.js";
34
// import FakeBookings from "@/data/fakeBookings.json";
45

@@ -10,7 +11,7 @@ const Bookings = () => {
1011
return (
1112
<main className="bookings">
1213
<Search search={search} />
13-
{/* <SearchResults results={FakeBookings} /> */}
14+
<SearchResult />
1415
</main>
1516
);
1617
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import "./SearchResult.scss";
2+
import FakeBookings from "@/data/fakeBookings.json";
3+
import TableBody from "./TableBody";
4+
import TableHead from "./TableHead";
5+
const Bookings = FakeBookings;
6+
function SearchResult() {
7+
return (
8+
<table>
9+
<thead>
10+
<TableHead />
11+
</thead>
12+
<tbody>
13+
{Bookings.map((book) => (
14+
<>
15+
<TableBody
16+
key={book.id}
17+
id={book.id}
18+
title={book.title}
19+
firstName={book.firstName}
20+
surName={book.surname}
21+
email={book.email}
22+
roomId={book.roomId}
23+
checkInDate={book.checkInDate}
24+
checkOutDate={book.checkOutDate}
25+
/>
26+
</>
27+
))}
28+
</tbody>
29+
</table>
30+
);
31+
}
32+
export default SearchResult;
33+
console.log(SearchResult());
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
table {
2+
border-collapse: collapse;
3+
width: 100%;
4+
}
5+
6+
thead {
7+
background-color: #f2f2f2;
8+
}
9+
10+
th,
11+
td {
12+
padding: 8px;
13+
text-align: left;
14+
border-bottom: 1px solid #ddd;
15+
}
16+
17+
th {
18+
font-weight: bold;
19+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// import FakeBookings from "@/data/fakeBookings.json";
2+
3+
function TableBody(props) {
4+
let {
5+
id,
6+
title,
7+
name,
8+
firstName,
9+
surName,
10+
email,
11+
roomId,
12+
checkInDate,
13+
checkOutDate,
14+
} = props;
15+
return (
16+
<>
17+
<tr key={id}>
18+
<td>{id}</td>
19+
<td>{title}</td>
20+
<td>{firstName}</td>
21+
<td>{surName}</td>
22+
<td>{email}</td>
23+
<td>{roomId}</td>
24+
<td>{checkInDate}</td>
25+
<td>{checkOutDate}</td>
26+
</tr>
27+
</>
28+
);
29+
}
30+
31+
export default TableBody;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
function TableHead() {
2+
return (
3+
<>
4+
<tr>
5+
<th>ID</th>
6+
<th>Title</th>
7+
<th>First name</th>
8+
<th>Lastname</th>
9+
<th>Email</th>
10+
<th>Room id</th>
11+
<th>Check in date</th>
12+
<th>Check out date</th>
13+
</tr>
14+
</>
15+
);
16+
}
17+
export default TableHead;

0 commit comments

Comments
 (0)