Closed GamerGirlandCo closed 2 months ago
something like
export interface Pagination {
/**
* If a boolean, enables/disables paging with the default configuration. If a number, paging will be
* enabled with the given number of entries per page.
*/
paging?: number | boolean;
/** The initial page of the table. */
initialPage?: number;
/** Controlled prop for setting the page of the table. */
page?: number;
}
which could then be extended like this
export interface TableProps<T> extends Pagination {
// ...
}
It saves some typing, but the main benefit of extracting is if we can actually write generic code that just needs Pagination
; is there anywhere where we would benefit doing this?
It saves some typing, but the main benefit of extracting is if we can actually write generic code that just needs
Pagination
; is there anywhere where we would benefit doing this?
i'm experimenting with creating a generic usePagination
hook. as of right now, the only place where it doesn't work is the table component
I've added a usePaging
hook for these purposes... can review if having a paging interface is useful in the future.
all the views currently implemented (List and Table) have pagination props:
https://github.com/blacksmithgu/datacore/blob/b6d7ed7c0480ee2879162499388ea18da793b583/src/ui/table.tsx#L31-L40
i was thinking, maybe we could move these to a separate interface, and have
TableProps
andListState
extend said interface, to avoid repitition.what do you think?