-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to add columns/properties to the table
- Refactored the logic within AddPropertyHeader to update the store when the add button is clicked. No more debounce. - Adjustments made the the people store and now using 'immer' to handle mutations to the state in a safe manner. - Moved selectable cells/header components to their own files.
- Loading branch information
1 parent
9e6cab2
commit 1e3a939
Showing
8 changed files
with
111 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,3 +88,4 @@ Customise | |
popperjs | ||
tanstack | ||
upsert | ||
immer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
frontend/src/features/people/components/table/cells/SelectableCell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Row } from '@tanstack/react-table'; | ||
import { IndeterminateCheckbox } from 'components'; | ||
|
||
const SelectableHeader = <TData extends object | unknown>({ row }: { row: Row<TData> }) => { | ||
return ( | ||
<div className="flex items-center justify-center p-2 border-r border-crumpet-light-200"> | ||
<IndeterminateCheckbox | ||
{...{ | ||
checked: row.getIsSelected(), | ||
disabled: !row.getCanSelect(), | ||
indeterminate: row.getIsSomeSelected(), | ||
onChange: row.getToggleSelectedHandler(), | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SelectableHeader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
frontend/src/features/people/components/table/headers/SelectableHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Table } from '@tanstack/react-table'; | ||
import { IndeterminateCheckbox } from 'components'; | ||
|
||
const SelectableHeader = <TData extends object | unknown>({ table }: { table: Table<TData> }) => { | ||
return ( | ||
<div className="flex items-center justify-center p-2 border-r border-crumpet-light-200"> | ||
<IndeterminateCheckbox | ||
{...{ | ||
checked: table.getIsAllRowsSelected(), | ||
indeterminate: table.getIsSomeRowsSelected(), | ||
onChange: table.getToggleAllRowsSelectedHandler(), | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SelectableHeader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters