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
Add pagination #53
Add pagination #53
Conversation
@@ -66,6 +66,7 @@ | |||
"dependencies": { | |||
"classnames": "~2.2.6", | |||
"lodash.sortby": "^4.7.0", | |||
"query-string": "^6.2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ArsArsenal will build a query for you. You just have to return an object from the new listQuery
option
src/components/table-view/index.tsx
Outdated
@@ -45,15 +46,15 @@ class TableView extends React.Component<Props, State> { | |||
return Array.isArray(picked) ? picked.indexOf(id) >= 0 : id === picked | |||
} | |||
|
|||
renderRow(item: Record, index: number) { | |||
renderRow(item: Record, index: number, list) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack, this is gonna break TS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
src/components/gallery.tsx
Outdated
@@ -17,8 +19,13 @@ interface Props { | |||
picked: Array<string | number> | |||
} | |||
|
|||
function getAnimationDelay(index) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔪 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
let outer = container.getBoundingClientRect() | ||
let inner = nextChild.getBoundingClientRect() | ||
|
||
if (inner.top < outer.bottom + outer.height * 0.5) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a simpler and perhaps more performant way to do this using scrollTop
and scrollHeight
? The answer may be no
but I wanted to ask.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can give it another shot. I really strugged with this.
render: state => null | ||
} | ||
|
||
static getDerivedStateFromProps(props: Props, lastState: State) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat.
This commit adds pagination to ArsArsenal. It breaks up the data fetcher and URL building options to make URL building clearer and adds logic ot watch the last item in a list to trigger a new page of data. I need some way of identicating that pagination is done. In a follow-up commit, I'd like to add a new option for "Pagination is done". It would be nice to reduce configuration of this to be bear minimum.
Types were a wreck. Fixed. I'll send some follow-up PRs to this branch, I still need to add a way to tell the pagination to stop. |
This commit adds pagination to ArsArsenal. It breaks up the data
fetcher and URL building options to make URL building clearer and
adds logic ot watch the last item in a list to trigger a new page
of data.
I need some way of identicating that pagination is done. In a
follow-up commit, I'd like to add a new option for "Pagination is
done". It would be nice to reduce configuration of this to be bear
minimum.