Skip to content

Commit 4c7ff4d

Browse files
authored
feat(add-tests-for-sorting): Add tests for custom sorting and remove yarn.lock (#9)
1 parent 2ed712f commit 4c7ff4d

6 files changed

Lines changed: 65 additions & 11313 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
dist
2+
coverage

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# React Final Table ![CI](https://github.com/Buuntu/react-final-table/workflows/tests/badge.svg) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
22

3-
A headless UI for React tables, inspired by [react-table](https://github.com/tannerlinsley/react-table) but with Typescript
4-
support built in.
3+
A headless UI library for React tables, inspired by
4+
[react-table](https://github.com/tannerlinsley/react-table) but with Typescript
5+
support built in and a simpler API.
56

67
## Features
78

@@ -34,7 +35,8 @@ npm install react-final-table
3435

3536
### `useTable`
3637

37-
This is the main hook exposed by the library and should be your entrypoint for any table functionality. Only `columns` and `data` are required as arguments:
38+
This is the main hook exposed by the library and should be your entrypoint for
39+
any table functionality. Only `columns` and `data` are required as arguments:
3840

3941
```jsx
4042
const {
@@ -44,20 +46,20 @@ const {
4446
selectedRows
4547
} = useTable(columns, data, {
4648
selectable?: boolean,
47-
filter?: (rows: RowType[]) => RowType[],
49+
filter?: (rows: RowType<T>[]) => RowType<T>[],
4850
});
4951
```
5052

5153
### Basic example
5254

5355
```tsx
54-
import { useTable, ColumnType[] } from 'react-final-table';
56+
import { useTable } from 'react-final-table';
5557

56-
const columns: ColumnType[] = [
58+
const columns = [
5759
{
5860
name: 'firstName',
5961
label: 'First Name',
60-
render: ({value}) => <h1>{value}</h1> // optional
62+
render: ({ value }) => <h1>{value}</h1>, // optional
6163
},
6264
{
6365
name: 'lastName',
@@ -99,7 +101,7 @@ const MyTable = () => {
99101
</tbody>
100102
</table>
101103
);
102-
}
104+
};
103105
```
104106

105107
### Advanced Example

0 commit comments

Comments
 (0)