Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow users to set page size in W3APIProvider #308

Merged
merged 3 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/react/w3console/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export function Logo (): JSX.Element {

export function App (): JSX.Element {
return (
<W3APIProvider>
<W3APIProvider uploadsListPageSize={10}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moar! i think we'll add fake multipage pagination to our list component like certain other consoles do.

Suggested change
<W3APIProvider uploadsListPageSize={10}>
<W3APIProvider uploadsListPageSize={60}>

Copy link
Contributor

@olizilla olizilla Jan 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so like fetch 60 but show the first 20 as "page 1" and then show "page 2" and "page 3" as links and then "..." to imply more pages, and then fetch the next n when the user flips through the pages, kinda thing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok cool - will bump to 20 for now, and create an issue to keep this rolling

<Authenticator>
<div className='flex min-h-full w-full'>
<nav className='flex-none w-64 bg-gray-900 text-white px-4 pb-4 border-r border-gray-800'>
Expand Down
9 changes: 7 additions & 2 deletions packages/react/src/providers/W3API.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ export interface UploaderProviderProps extends ServiceConfig {
children?: JSX.Element
}

export function W3APIProvider ({ children }: { children: JSX.Element | JSX.Element[] }): JSX.Element {
export interface W3APIProviderProps {
children: JSX.Element | JSX.Element[]
uploadsListPageSize?: number
}

export function W3APIProvider ({ children, uploadsListPageSize }: W3APIProviderProps): JSX.Element {
return (
<KeyringProvider>
<UploaderProvider>
<UploadsListProvider>
<UploadsListProvider size={uploadsListPageSize}>
<>{children}</>
</UploadsListProvider>
</UploaderProvider>
Expand Down