mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
refactor(groups): migrate groups selectors to react [EE-3842] (#8936)
This commit is contained in:
parent
2018529add
commit
e91b4f5c83
38 changed files with 543 additions and 627 deletions
|
@ -1,4 +1,4 @@
|
|||
import { useMemo } from 'react';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { useStore } from 'zustand';
|
||||
|
||||
import { useSearchBarState } from './SearchBar';
|
||||
|
@ -27,3 +27,23 @@ export function useTableState<
|
|||
[settings, search, setSearch]
|
||||
);
|
||||
}
|
||||
|
||||
export function useTableStateWithoutStorage(
|
||||
defaultSortKey: string
|
||||
): BasicTableSettings & {
|
||||
setSearch: (search: string) => void;
|
||||
search: string;
|
||||
} {
|
||||
const [search, setSearch] = useState('');
|
||||
const [pageSize, setPageSize] = useState(10);
|
||||
const [sortBy, setSortBy] = useState({ id: defaultSortKey, desc: false });
|
||||
|
||||
return {
|
||||
search,
|
||||
setSearch,
|
||||
pageSize,
|
||||
setPageSize,
|
||||
setSortBy: (id: string, desc: boolean) => setSortBy({ id, desc }),
|
||||
sortBy,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue