Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NW6 | Fikret Ellek | React-Module-Project | Week-1 | Calculate Duration #42

Merged
merged 1 commit into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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")}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good :)

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;