Skip to content

Commit d376aec

Browse files
committed
feat: table scaffolding
1 parent c23c225 commit d376aec

File tree

7 files changed

+73
-0
lines changed

7 files changed

+73
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const Table = () => {}
2+
3+
export default Table

src/Shared/Components/Table/constants.ts

Whitespace-only changes.

src/Shared/Components/Table/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as Table } from './Table.component'
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.table {
2+
table, caption, tbody, tfoot, thead, tr, th, td {
3+
margin: 0;
4+
padding: 0;
5+
border: 0;
6+
outline: 0;
7+
font-size: 100%;
8+
vertical-align: baseline;
9+
background: transparent;
10+
}
11+
}

src/Shared/Components/Table/types.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { ReactElement } from 'react'
2+
import { SortableTableHeaderCellProps } from '@Common/SortableTableHeaderCell'
3+
import { BulkOperation, BulkOperationModalProps } from '../BulkOperations'
4+
import { ConfirmationModalProps } from '../ConfirmationModal'
5+
6+
type SizeType =
7+
| {
8+
range: [number, number]
9+
fixed?: never
10+
}
11+
| {
12+
range?: never
13+
fixed: number | 'auto'
14+
}
15+
16+
export interface Column
17+
extends Pick<SortableTableHeaderCellProps, 'isSortable' | 'isResizable' | 'showTippyOnTruncate'> {
18+
label: string
19+
size?: SizeType
20+
}
21+
22+
export interface Cell {
23+
label: string
24+
data?: unknown
25+
render?: (data?: Cell['data']) => JSX.Element
26+
}
27+
28+
export type BulkActionConfigType = (
29+
| {
30+
applyActionOnEachSelection: true
31+
action: BulkOperation['operation']
32+
Icon: ReactElement
33+
confirmationConfig?: ConfirmationModalProps<true>
34+
}
35+
| {
36+
applyActionOnEachSelection: false
37+
action: (
38+
abortControllerRef: Parameters<BulkOperation['operation']>[0],
39+
data: Array<Parameters<BulkOperation['operation']>[1]>,
40+
) => ReturnType<BulkOperation['operation']>
41+
}
42+
) &
43+
Pick<BulkOperationModalProps, 'hideResultsDrawer'>
44+
45+
export enum PaginationEnum {
46+
PAGINATED = 'paginated',
47+
INFINITE = 'infinite',
48+
NOT_PAGINATED = 'not-paginated',
49+
}
50+
51+
export enum FiltersTypeEnum {
52+
STATE = 'state',
53+
URL = 'url',
54+
NONE = 'none',
55+
}
56+
57+
// TODO: handle onRowClick in View

src/Shared/Components/Table/utils.ts

Whitespace-only changes.

src/Shared/Components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,4 @@ export * from './CustomInput'
8383
export * from './InfoBlock'
8484
export * from './CodeEditorWrapper'
8585
export * from './SSOProviderIcon'
86+
export * from './Table'

0 commit comments

Comments
 (0)