-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Integrate col mgmt modal feature with table hooks
Signed-off-by: Ian Bolton <[email protected]>
- Loading branch information
1 parent
36d128e
commit d10dbac
Showing
8 changed files
with
363 additions
and
80 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
client/src/app/hooks/table-controls/column/useColumnState.ts
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,25 @@ | ||
import { useState } from "react"; | ||
|
||
export interface ColumnState<TColumnKey extends string> { | ||
id: TColumnKey; | ||
label: string; | ||
isVisible: boolean; | ||
} | ||
|
||
export interface IColumnState<TColumnKey extends string> { | ||
columns: ColumnState<TColumnKey>[]; | ||
setColumns: (newColumns: ColumnState<TColumnKey>[]) => void; | ||
} | ||
|
||
interface IColumnStateArgs<TColumnKey extends string> { | ||
initialColumns: ColumnState<TColumnKey>[]; | ||
} | ||
|
||
export const useColumnState = <TColumnKey extends string>( | ||
args: IColumnStateArgs<TColumnKey> | ||
): IColumnState<TColumnKey> => { | ||
const [columns, setColumns] = useState<ColumnState<TColumnKey>[]>( | ||
args.initialColumns | ||
); | ||
return { columns, setColumns }; | ||
}; |
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
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
Oops, something went wrong.