Skip to content

Commit

Permalink
Merge pull request #42 from RbAvci/Feature/CalculateDuration
Browse files Browse the repository at this point in the history
NW6 | Fikret Ellek | React-Module-Project | Week-1 | Calculate Duration
  • Loading branch information
RbAvci authored Mar 9, 2024
2 parents 0642f48 + adb3b28 commit 9d34026
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
16 changes: 10 additions & 6 deletions src/components/SearchResults/SearchResults.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// SearchResults.jsx
import React from 'react';
import TableHead from './TableHead';
import TableBody from './TableBody';
import React from "react";
import TableHead from "./TableHead";
import TableBody from "./TableBody";
import dayjs from "dayjs";

const SearchResults = ({results}) => {
const SearchResults = ({ results }) => {
return (
<table>
<thead>
Expand All @@ -17,13 +18,16 @@ const SearchResults = ({results}) => {
title={booking.title}
firstName={booking.firstName}
surName={booking.surname}
nights={dayjs(booking.checkOutDate)
.diff(dayjs(booking.checkInDate), "days")
.toString()
.padStart(2, "0")}
email={booking.email}
/>
))}
</tbody>
</table>
);
}
};

export default SearchResults;

7 changes: 4 additions & 3 deletions src/components/SearchResults/TableBody.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React from 'react';
import React from "react";

const TableBody = ({ id, title, firstName, surName, email }) => {
const TableBody = ({ id, title, firstName, surName, email, nights }) => {
return (
<tr>
<td>{id}</td>
<td>{title}</td>
<td>{firstName}</td>
<td>{surName}</td>
<td>{nights}</td>
<td>{email}</td>
</tr>
);
}
};

export default TableBody;
7 changes: 4 additions & 3 deletions src/components/SearchResults/TableHead.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React from "react";

const TableHead = () => {
return (
Expand All @@ -7,9 +7,10 @@ const TableHead = () => {
<th>Title</th>
<th>First Name</th>
<th>Last Name</th>
<th>Nights</th>
<th>Email</th>
</tr>
);
}
};

export default TableHead;
export default TableHead;

0 comments on commit 9d34026

Please sign in to comment.