File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414 "test:watch" : " vitest"
1515 },
1616 "dependencies" : {
17+ "dayjs" : " ^1.11.10" ,
1718 "react" : " ^18.2.0" ,
1819 "react-dom" : " ^18.2.0"
1920 },
Original file line number Diff line number Diff line change 11import Bookings from "@/components/Bookings/Bookings.jsx" ;
22import "./App.scss" ;
3-
4- import Deck from "../Deck/Deck" ;
5-
63import Footer from "../Footer/Footer" ;
74import Deck from "../Deck/Deck" ;
85import AppHeader from "../AppHeader/AppHeader" ;
6+
97const App = ( ) => (
108 < div className = "app" >
11- < header className = "app__header" >
12- < h1 className = "app__heading" > CYF Hotel</ h1 >
13- </ header >
14- < AppHeader />
9+ < div className = "header" >
10+ < header className = "app__header" >
11+ < h1 className = "app__heading" > CYF Hotel</ h1 >
12+ </ header >
13+ < AppHeader />
14+ </ div >
1515 < Bookings />
1616
1717 < Deck />
Original file line number Diff line number Diff line change 1414
1515.app__heading {
1616 margin : 0 ;
17+ margin-top : 30% ;
1718}
1819
1920.footer {
Original file line number Diff line number Diff line change 11import Logo from "@/assets/spa-logo.png" ;
22import "./AppHeader.scss" ;
3- const AppHeader = ( ) => < img src = { Logo } > </ img > ;
3+ const AppHeader = ( ) => < img className = "LogoImg" src = { Logo } > </ img > ;
44export default AppHeader ;
Original file line number Diff line number Diff line change 77 max-width : 100px ;
88 }
99}
10+
11+ .header {
12+ margin-right : 35% ;
13+ margin-left : 35% ;
14+ display : flex ;
15+ flex-direction : row-reverse ;
16+ justify-content : space-evenly ;
17+ }
18+
19+ .LogoImg {
20+ height : 150px ;
21+ width : 150px ;
22+ }
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import "./SearchResult.scss";
22import FakeBookings from "@/data/fakeBookings.json" ;
33import TableBody from "./TableBody" ;
44import TableHead from "./TableHead" ;
5+ import dayjs from "dayjs" ;
6+
57const Bookings = FakeBookings ;
68function SearchResult ( ) {
79 return (
@@ -10,21 +12,28 @@ function SearchResult() {
1012 < TableHead />
1113 </ thead >
1214 < 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- ) ) }
15+ { Bookings . map ( ( book ) => {
16+ const stayNightsTotal = dayjs ( book . checkOutDate ) . diff (
17+ dayjs ( book . checkInDate ) ,
18+ "day"
19+ ) ;
20+ return (
21+ < >
22+ < TableBody
23+ key = { book . id }
24+ id = { book . id }
25+ title = { book . title }
26+ firstName = { book . firstName }
27+ surName = { book . surname }
28+ email = { book . email }
29+ roomId = { book . roomId }
30+ checkInDate = { book . checkInDate }
31+ checkOutDate = { book . checkOutDate }
32+ stayNights = { stayNightsTotal }
33+ />
34+ </ >
35+ ) ;
36+ } ) }
2837 </ tbody >
2938 </ table >
3039 ) ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ function TableBody(props) {
1111 roomId,
1212 checkInDate,
1313 checkOutDate,
14+ stayNights,
1415 } = props ;
1516 return (
1617 < >
@@ -23,6 +24,7 @@ function TableBody(props) {
2324 < td > { roomId } </ td >
2425 < td > { checkInDate } </ td >
2526 < td > { checkOutDate } </ td >
27+ < td > { stayNights } </ td >
2628 </ tr >
2729 </ >
2830 ) ;
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ function TableHead() {
1010 < th > Room id</ th >
1111 < th > Check in date</ th >
1212 < th > Check out date</ th >
13+ < th > Total Nights to Stay</ th >
1314 </ tr >
1415 </ >
1516 ) ;
You can’t perform that action at this time.
0 commit comments