File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,12 +4,14 @@ import "./App.scss";
44import Deck from "../Deck/Deck" ;
55
66import Footer from "../Footer/Footer" ;
7-
7+ import Deck from "../Deck/Deck" ;
8+ import AppHeader from "../AppHeader/AppHeader" ;
89const 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 />
Original file line number Diff line number Diff line change 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 ;
Original file line number Diff line number Diff line change 11import 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} ;
Original file line number Diff line number Diff line change 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 ( ) ) ;
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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 ;
Original file line number Diff line number Diff line change 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 ;
You can’t perform that action at this time.
0 commit comments