|
1 | 1 | import {Menu, MenuButton, MenuItem, MenuItems, Transition} from "@headlessui/react"
|
2 | 2 | import {
|
3 |
| - ChevronDownIcon, |
4 |
| - ChevronRightIcon, |
5 |
| - ChevronUpIcon, |
| 3 | + ChevronDownIcon, |
| 4 | + ChevronRightIcon, |
| 5 | + ChevronUpIcon, ExclamationTriangleIcon, |
6 | 6 | } from "@heroicons/react/24/solid";
|
7 | 7 | import {Column, flexRender, Table} from "@tanstack/react-table"
|
8 | 8 | import {ChevronLeftIcon} from "@heroicons/react/20/solid";
|
@@ -96,31 +96,64 @@ const AvoRedTable = (props: Props) => {
|
96 | 96 | ))}
|
97 | 97 | </thead>
|
98 | 98 | <tbody>
|
99 |
| - {props.table.getRowModel().rows.map(row => ( |
100 |
| - <tr key={row.id} className="border-b"> |
101 |
| - {row.getVisibleCells().map(cell => ( |
102 |
| - <td key={cell.id} className="py-3 px-4"> |
103 |
| - {flexRender(cell.column.columnDef.cell, cell.getContext())} |
104 |
| - </td> |
105 |
| - ))} |
| 99 | + |
| 100 | + {(props.table.getRowModel().rows.length <= 0) ? ( |
| 101 | + <tr> |
| 102 | + <td colSpan={props.table.getHeaderGroups()[0].headers.length}> |
| 103 | + <div className="flex w-full justify-center py-10"> |
| 104 | + <ExclamationTriangleIcon className="h-8 w-8" /> |
| 105 | + <span className="ml-5"> |
| 106 | + Sorry no records found |
| 107 | + </span> |
| 108 | + </div> |
| 109 | + </td> |
106 | 110 | </tr>
|
107 |
| - ))} |
| 111 | + ) : ( |
| 112 | + <> |
| 113 | + {props.table.getRowModel().rows.map(row => ( |
| 114 | + <tr key={row.id} className="border-b"> |
| 115 | + {row.getVisibleCells().map(cell => ( |
| 116 | + <td key={cell.id} className="py-3 px-4"> |
| 117 | + {flexRender(cell.column.columnDef.cell, cell.getContext())} |
| 118 | + </td> |
| 119 | + ))} |
| 120 | + </tr> |
| 121 | + ))} |
| 122 | + </> |
| 123 | + )} |
| 124 | + |
| 125 | + |
108 | 126 | </tbody>
|
109 | 127 | </table>
|
110 | 128 | <nav className="my-5 flex items-center -space-x-px">
|
111 | 129 | <button type="button"
|
112 | 130 | onClick={() => props.table.previousPage()}
|
113 | 131 | disabled={!props.table.getCanPreviousPage()}
|
114 |
| - className="py-2 px-2.5 inline-flex justify-center items-center gap-x-1.5 text-sm first:rounded-s-lg last:rounded-e-lg border border-gray-200 text-gray-800 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:border-neutral-700 dark:text-white dark:hover:bg-white/10 dark:focus:bg-white/10"> |
| 132 | + className="bg-primary-400 ring-1 text-white ring-primary-600 py-2 px-2.5 inline-flex |
| 133 | + justify-center items-center gap-x-1.5 text-sm |
| 134 | + first:rounded-s-lg last:rounded-e-lg |
| 135 | + focus:outline-none focus:bg-gray-100 |
| 136 | + disabled:opacity-90 |
| 137 | + disabled:ring-gray-200 |
| 138 | + disabled:bg-gray-200 |
| 139 | + disabled:text-gray-800 |
| 140 | + disabled:pointer-events-none"> |
115 | 141 | <ChevronLeftIcon className="w-4 h-4" />
|
116 | 142 | <span className="hidden sm:block">Previous</span>
|
117 | 143 | </button>
|
118 | 144 |
|
119 |
| - |
120 | 145 | <button type="button"
|
121 | 146 | onClick={() => props.table.nextPage()}
|
122 | 147 | disabled={!props.table.getCanNextPage()}
|
123 |
| - className="min-h-[38px] min-w-[38px] py-2 px-2.5 inline-flex justify-center items-center gap-x-1.5 text-sm first:rounded-s-lg last:rounded-e-lg border border-gray-200 text-gray-800 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:border-neutral-700 dark:text-white dark:hover:bg-white/10 dark:focus:bg-white/10"> |
| 148 | + className="bg-primary-400 ring-1 text-white ring-primary-600 py-2 px-2.5 inline-flex |
| 149 | + justify-center items-center gap-x-1.5 text-sm |
| 150 | + first:rounded-s-lg last:rounded-e-lg |
| 151 | + focus:outline-none focus:bg-gray-100 |
| 152 | + disabled:opacity-90 |
| 153 | + disabled:ring-gray-200 |
| 154 | + disabled:bg-gray-200 |
| 155 | + disabled:text-gray-800 |
| 156 | + disabled:pointer-events-none"> |
124 | 157 | <span className="hidden sm:block">Next</span>
|
125 | 158 | <ChevronRightIcon className="w-4 h-4" />
|
126 | 159 | </button>
|
|
0 commit comments