mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
* refactor: remove C2D * fix: build * fix: tests * fix: get only datasets from aquarius * fix: test * fix: test * fix: text * fix: test * chore: regenerate package-lock * fix: fitler search params * fix: textarea, select class issues * fix: test * chore: remove comment * chore: remove comments * Feat/remove ve (#2038) * feat: remove ve allocations * feat: remove allocated veOcean * feat: update depedencies (#2045) * feat: update depedencies * feat: update more depedencies * fix: input field style * remove total allocation from search * filter fixes * fix test --------- Co-authored-by: mihai <mihai.scarlat@smartcontrol.ro>
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import React, { ReactElement } from 'react'
|
|
import DataTable, { TableProps, TableColumn } from 'react-data-table-component'
|
|
import Loader from '../Loader'
|
|
import Pagination from '@shared/Pagination'
|
|
import { PaginationComponent } from 'react-data-table-component/dist/DataTable/types'
|
|
import Empty from './Empty'
|
|
import { customStyles } from './_styles'
|
|
|
|
// Hack in support for returning components for each row, as this works,
|
|
// but is not supported by the typings.
|
|
export interface TableOceanColumn<T> extends TableColumn<T> {
|
|
selector?: (row: T) => any
|
|
}
|
|
|
|
export interface TableOceanProps<T> extends TableProps<T> {
|
|
columns: TableOceanColumn<T>[]
|
|
isLoading?: boolean
|
|
emptyMessage?: string
|
|
sortField?: string
|
|
sortAsc?: boolean
|
|
className?: string
|
|
}
|
|
|
|
export default function Table({
|
|
data,
|
|
columns,
|
|
isLoading,
|
|
emptyMessage,
|
|
pagination,
|
|
paginationPerPage,
|
|
sortField,
|
|
sortAsc,
|
|
className,
|
|
...props
|
|
}: TableOceanProps<any>): ReactElement {
|
|
return (
|
|
<div className={className}>
|
|
<DataTable
|
|
columns={columns}
|
|
data={data}
|
|
pagination={pagination || data?.length >= 9}
|
|
paginationPerPage={paginationPerPage || 10}
|
|
noDataComponent={<Empty message={emptyMessage} />}
|
|
progressPending={isLoading}
|
|
progressComponent={<Loader />}
|
|
paginationComponent={Pagination as unknown as PaginationComponent}
|
|
defaultSortFieldId={sortField}
|
|
defaultSortAsc={sortAsc}
|
|
theme="ocean"
|
|
customStyles={customStyles}
|
|
{...props}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|