Skip to content

Commit f2bdc65

Browse files
authored
Merge pull request #237 from avored/229-ui-improvements
few ui improvements
2 parents 98a3ca2 + 836ddd6 commit f2bdc65

File tree

2 files changed

+47
-15
lines changed

2 files changed

+47
-15
lines changed

public/install_demo

-1
This file was deleted.

react-admin/src/components/AvoRedTable.tsx

+47-14
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {Menu, MenuButton, MenuItem, MenuItems, Transition} from "@headlessui/react"
22
import {
3-
ChevronDownIcon,
4-
ChevronRightIcon,
5-
ChevronUpIcon,
3+
ChevronDownIcon,
4+
ChevronRightIcon,
5+
ChevronUpIcon, ExclamationTriangleIcon,
66
} from "@heroicons/react/24/solid";
77
import {Column, flexRender, Table} from "@tanstack/react-table"
88
import {ChevronLeftIcon} from "@heroicons/react/20/solid";
@@ -96,31 +96,64 @@ const AvoRedTable = (props: Props) => {
9696
))}
9797
</thead>
9898
<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>
106110
</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+
108126
</tbody>
109127
</table>
110128
<nav className="my-5 flex items-center -space-x-px">
111129
<button type="button"
112130
onClick={() => props.table.previousPage()}
113131
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">
115141
<ChevronLeftIcon className="w-4 h-4" />
116142
<span className="hidden sm:block">Previous</span>
117143
</button>
118144

119-
120145
<button type="button"
121146
onClick={() => props.table.nextPage()}
122147
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">
124157
<span className="hidden sm:block">Next</span>
125158
<ChevronRightIcon className="w-4 h-4" />
126159
</button>

0 commit comments

Comments
 (0)