[offers][feat] add table loading status, refactor table (#368)
parent
7d15aa43cf
commit
0eb4f3fc5b
@ -0,0 +1,32 @@
|
|||||||
|
import Link from 'next/link';
|
||||||
|
|
||||||
|
import type { OfferTableRowData } from '~/components/offers/table/types';
|
||||||
|
|
||||||
|
export type OfferTableRowProps = Readonly<{ row: OfferTableRowData }>;
|
||||||
|
|
||||||
|
export default function OfferTableRow({
|
||||||
|
row: { company, date, id, profileId, salary, title, yoe },
|
||||||
|
}: OfferTableRowProps) {
|
||||||
|
return (
|
||||||
|
<tr
|
||||||
|
key={id}
|
||||||
|
className="border-b bg-white hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-800 dark:hover:bg-gray-600">
|
||||||
|
<th
|
||||||
|
className="whitespace-nowrap py-4 px-6 font-medium text-gray-900 dark:text-white"
|
||||||
|
scope="row">
|
||||||
|
{company}
|
||||||
|
</th>
|
||||||
|
<td className="py-4 px-6">{title}</td>
|
||||||
|
<td className="py-4 px-6">{yoe}</td>
|
||||||
|
<td className="py-4 px-6">{salary}</td>
|
||||||
|
<td className="py-4 px-6">{date}</td>
|
||||||
|
<td className="space-x-4 py-4 px-6">
|
||||||
|
<Link
|
||||||
|
className="font-medium text-indigo-600 hover:underline dark:text-indigo-500"
|
||||||
|
href={`/offers/profile/${profileId}`}>
|
||||||
|
View Profile
|
||||||
|
</Link>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
import { Pagination } from '@tih/ui';
|
||||||
|
|
||||||
|
import type { PaginationType } from '~/components/offers/table/types';
|
||||||
|
|
||||||
|
type OffersTablePaginationProps = Readonly<{
|
||||||
|
endNumber: number;
|
||||||
|
handlePageChange: (page: number) => void;
|
||||||
|
pagination: PaginationType;
|
||||||
|
startNumber: number;
|
||||||
|
}>;
|
||||||
|
|
||||||
|
export default function OffersTablePagination({
|
||||||
|
endNumber,
|
||||||
|
pagination,
|
||||||
|
startNumber,
|
||||||
|
handlePageChange,
|
||||||
|
}: OffersTablePaginationProps) {
|
||||||
|
return (
|
||||||
|
<nav
|
||||||
|
aria-label="Table navigation"
|
||||||
|
className="flex items-center justify-between p-4">
|
||||||
|
<span className="text-sm font-normal text-gray-500 dark:text-gray-400">
|
||||||
|
Showing
|
||||||
|
<span className="font-semibold text-gray-900 dark:text-white">
|
||||||
|
{` ${startNumber} - ${endNumber} `}
|
||||||
|
</span>
|
||||||
|
{`of `}
|
||||||
|
<span className="font-semibold text-gray-900 dark:text-white">
|
||||||
|
{pagination.totalItems}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<Pagination
|
||||||
|
current={pagination.currentPage}
|
||||||
|
end={pagination.numOfPages}
|
||||||
|
label="Pagination"
|
||||||
|
pagePadding={1}
|
||||||
|
start={1}
|
||||||
|
onSelect={(currPage) => {
|
||||||
|
handlePageChange(currPage);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</nav>
|
||||||
|
);
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
export type OfferTableRowData = {
|
||||||
|
company: string;
|
||||||
|
date: string;
|
||||||
|
id: string;
|
||||||
|
profileId: string;
|
||||||
|
salary: number | undefined;
|
||||||
|
title: string;
|
||||||
|
yoe: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-shadow
|
||||||
|
export enum YOE_CATEGORY {
|
||||||
|
INTERN = 0,
|
||||||
|
ENTRY = 1,
|
||||||
|
MID = 2,
|
||||||
|
SENIOR = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PaginationType = {
|
||||||
|
currentPage: number;
|
||||||
|
numOfItems: number;
|
||||||
|
numOfPages: number;
|
||||||
|
totalItems: number;
|
||||||
|
};
|
Loading…
Reference in new issue