@snapdragonsnursery/react-components 1.1.18 → 1.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapdragonsnursery/react-components",
3
- "version": "1.1.18",
3
+ "version": "1.1.20",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -420,8 +420,9 @@ const ChildSearchPage = ({
420
420
  };
421
421
 
422
422
  // Calculate pagination display values
423
- const startItem = pagination.totalCount > 0 ? (pagination.page - 1) * pagination.pageSize + 1 : 0;
424
- const endItem = Math.min(pagination.page * pagination.pageSize, pagination.totalCount);
423
+ const actualTotalCount = pagination.totalCount || children.length;
424
+ const startItem = actualTotalCount > 0 ? (pagination.page - 1) * pagination.pageSize + 1 : 0;
425
+ const endItem = Math.min(pagination.page * pagination.pageSize, actualTotalCount);
425
426
 
426
427
  return (
427
428
  <div className="min-h-screen bg-gray-50 dark:bg-gray-900">
@@ -668,7 +669,7 @@ const ChildSearchPage = ({
668
669
  <div className="flex items-center justify-between">
669
670
  <div className="text-sm text-gray-600 dark:text-gray-400">
670
671
  {(pagination.totalCount > 0 || children.length > 0)
671
- ? `Showing ${startItem} to ${endItem} of ${pagination.totalCount || children.length} children`
672
+ ? `Showing ${startItem} to ${endItem} of ${actualTotalCount} children`
672
673
  : "No children found"}
673
674
  </div>
674
675
  </div>
@@ -745,7 +746,7 @@ const ChildSearchPage = ({
745
746
  Page {pagination.page} of {pagination.totalPages || 1}
746
747
  </div>
747
748
  <div className="text-sm text-gray-600 dark:text-gray-400">
748
- {pagination.totalCount || children.length} total children
749
+ {actualTotalCount} total children
749
750
  </div>
750
751
  </div>
751
752
 
@@ -754,8 +755,14 @@ const ChildSearchPage = ({
754
755
  <Pagination>
755
756
  <PaginationContent>
756
757
  <PaginationItem>
757
- <PaginationPrevious
758
- onClick={() => handlePageChange(pagination.page - 1)}
758
+ <PaginationPrevious
759
+ href="#"
760
+ onClick={(e) => {
761
+ e.preventDefault();
762
+ if (pagination.hasPreviousPage) {
763
+ handlePageChange(pagination.page - 1);
764
+ }
765
+ }}
759
766
  className={cn(
760
767
  !pagination.hasPreviousPage &&
761
768
  "pointer-events-none opacity-50"
@@ -786,7 +793,11 @@ const ChildSearchPage = ({
786
793
  </PaginationItem>
787
794
  <PaginationItem>
788
795
  <PaginationLink
789
- onClick={() => handlePageChange(page)}
796
+ href="#"
797
+ onClick={(e) => {
798
+ e.preventDefault();
799
+ handlePageChange(page);
800
+ }}
790
801
  isActive={page === pagination.page}
791
802
  >
792
803
  {page}
@@ -798,7 +809,11 @@ const ChildSearchPage = ({
798
809
  return (
799
810
  <PaginationItem key={page}>
800
811
  <PaginationLink
801
- onClick={() => handlePageChange(page)}
812
+ href="#"
813
+ onClick={(e) => {
814
+ e.preventDefault();
815
+ handlePageChange(page);
816
+ }}
802
817
  isActive={page === pagination.page}
803
818
  >
804
819
  {page}
@@ -808,8 +823,14 @@ const ChildSearchPage = ({
808
823
  })}
809
824
 
810
825
  <PaginationItem>
811
- <PaginationNext
812
- onClick={() => handlePageChange(pagination.page + 1)}
826
+ <PaginationNext
827
+ href="#"
828
+ onClick={(e) => {
829
+ e.preventDefault();
830
+ if (pagination.hasNextPage) {
831
+ handlePageChange(pagination.page + 1);
832
+ }
833
+ }}
813
834
  className={cn(
814
835
  !pagination.hasNextPage &&
815
836
  "pointer-events-none opacity-50"
@@ -34,10 +34,14 @@ const PaginationLink = React.forwardRef(
34
34
  ({ className, isActive, size = "icon", ...props }, ref) => (
35
35
  <Button
36
36
  aria-current={isActive ? "page" : undefined}
37
- variant={isActive ? "outline" : "ghost"}
37
+ variant={isActive ? "default" : "outline"}
38
38
  size={size}
39
39
  ref={ref}
40
- className={cn("cursor-pointer", className)}
40
+ className={cn(
41
+ "h-9 w-9 p-0",
42
+ isActive && "bg-primary text-primary-foreground hover:bg-primary/90",
43
+ className
44
+ )}
41
45
  {...props}
42
46
  />
43
47
  )