Skip to content

Commit b6a200e

Browse files
authored
Merge pull request #167 from UW-Macrostrat/pagination
Pagination fix
2 parents 7d9c8f9 + c5d4222 commit b6a200e

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

packages/ui-components/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [4.4.5] - 2025-08-12
4+
5+
Fix broken Pagination component
6+
37
## [4.4.4] - 2025-07-18
48

59
For PostgRESTInfiniteScrollView

packages/ui-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@macrostrat/ui-components",
3-
"version": "4.4.4",
3+
"version": "4.4.5",
44
"description": "UI components for React and Blueprint.js",
55
"main": "dist/cjs/index.js",
66
"module": "dist/esm/index.js",

packages/ui-components/src/api/paged.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import { APIResultView } from "./frontend";
66

77
const Pagination = (props) => {
88
const { currentPage, nextDisabled, setPage } = props;
9+
910
return h(ButtonGroup, [
1011
h(
1112
Button,
1213
{
13-
onClick: setPage(currentPage - 1),
14+
onClick: () => setPage(currentPage - 1),
1415
icon: "arrow-left",
1516
disabled: currentPage <= 0,
1617
},
@@ -19,7 +20,7 @@ const Pagination = (props) => {
1920
h(
2021
Button,
2122
{
22-
onClick: setPage(currentPage + 1),
23+
onClick: () => setPage(currentPage + 1),
2324
rightIcon: "arrow-right",
2425
disabled: nextDisabled,
2526
},
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { ComponentStory, ComponentMeta } from "@storybook/react-vite";
2+
import h from "@macrostrat/hyper";
3+
import { Pagination } from "../src";
4+
import { useState } from "react";
5+
6+
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
7+
export default {
8+
title: "UI components/Pagination",
9+
component: Pagination,
10+
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
11+
argTypes: {},
12+
} as ComponentMeta<typeof Pagination>;
13+
14+
export function Basic() {
15+
const [ix, setIX] = useState(0);
16+
return h("div", [
17+
h("p", `Current page: ${ix}`),
18+
h(Pagination, {
19+
currentPage: ix,
20+
nextDisabled: false,
21+
setPage: (page: number) => setIX(page),
22+
}),
23+
]);
24+
}

0 commit comments

Comments
 (0)