Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
abkarim committed Feb 16, 2023
1 parent 21a06c9 commit abe3641
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/react-table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function ReactTable({
setSearchBy,
total,
title,
data,
data = [],
emptyMessage = "Sorry, no data found",
footer = false,
header = true,
Expand Down
7 changes: 6 additions & 1 deletion src/react-table/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function ReactTable({
setSearchBy,
total,
title,
data,
data = [],
emptyMessage = "Sorry, no data found",
footer = false,
header = true,
Expand All @@ -34,6 +34,7 @@ export default function ReactTable({
searchBy={searchBy}
setSearchBy={setSearchBy}
/>

<table {...props} className="w-full">
{header === true && (
<thead className="bg-slate-200">
Expand All @@ -46,6 +47,7 @@ export default function ReactTable({
/>
</thead>
)}

<tbody>
{data.map((x) => {
return (
Expand All @@ -63,6 +65,7 @@ export default function ReactTable({
</tr>
);
})}

{data.length === 0 && (
<tr>
<td className="bg-slate-50 px-2" colSpan={title.length}>
Expand All @@ -71,6 +74,7 @@ export default function ReactTable({
</tr>
)}
</tbody>

{footer === true && (
<tfoot className="bg-slate-200">
<Title
Expand All @@ -83,6 +87,7 @@ export default function ReactTable({
</tfoot>
)}
</table>

<Footer
total={total}
itemsPerPage={itemsPerPage}
Expand Down

0 comments on commit abe3641

Please sign in to comment.