separate interface for pagination
GamerGirlandCo opened this issue · comments
all the views currently implemented (List and Table) have pagination props:
Lines 31 to 40 in b6d7ed7
i was thinking, maybe we could move these to a separate interface, and have TableProps
and ListState
extend said interface, to avoid repitition.
what do you think?
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.