@snapdragonsnursery/react-components 1.1.22 → 1.1.24
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 +1 -1
- package/src/ChildSearchPage.jsx +89 -87
package/package.json
CHANGED
package/src/ChildSearchPage.jsx
CHANGED
|
@@ -426,7 +426,7 @@ const ChildSearchPage = ({
|
|
|
426
426
|
|
|
427
427
|
return (
|
|
428
428
|
<div className="min-h-screen bg-gray-50 dark:bg-gray-900">
|
|
429
|
-
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-
|
|
429
|
+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
|
|
430
430
|
{/* Header */}
|
|
431
431
|
<div className="mb-8">
|
|
432
432
|
<h1 className="text-3xl font-bold text-gray-900 dark:text-white">
|
|
@@ -739,106 +739,108 @@ const ChildSearchPage = ({
|
|
|
739
739
|
|
|
740
740
|
{/* Pagination */}
|
|
741
741
|
{(pagination.totalCount > 0 || children.length > 0) && (
|
|
742
|
-
<div className="px-6 py-
|
|
742
|
+
<div className="px-6 py-6 border-t border-gray-200 dark:border-gray-700">
|
|
743
743
|
{/* Pagination Info */}
|
|
744
744
|
<div className="flex items-center justify-between mb-4">
|
|
745
745
|
<div className="text-sm text-gray-600 dark:text-gray-400">
|
|
746
746
|
Page {pagination.page} of {pagination.totalPages || 1}
|
|
747
747
|
</div>
|
|
748
748
|
<div className="text-sm text-gray-600 dark:text-gray-400">
|
|
749
|
-
{
|
|
749
|
+
{pagination.totalCount || children.length} total children
|
|
750
750
|
</div>
|
|
751
751
|
</div>
|
|
752
752
|
|
|
753
753
|
{/* Pagination Controls */}
|
|
754
754
|
{(pagination.totalPages > 1 || children.length > 0) && (
|
|
755
|
-
<
|
|
756
|
-
<
|
|
757
|
-
<
|
|
758
|
-
<
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
e
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
{
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
page === 1 ||
|
|
783
|
-
page === total ||
|
|
784
|
-
(page >= current - 1 && page <= current + 1)
|
|
785
|
-
);
|
|
786
|
-
})
|
|
787
|
-
.map((page, index, array) => {
|
|
788
|
-
if (index > 0 && array[index - 1] !== page - 1) {
|
|
755
|
+
<div className="flex justify-center">
|
|
756
|
+
<Pagination>
|
|
757
|
+
<PaginationContent>
|
|
758
|
+
<PaginationItem>
|
|
759
|
+
<PaginationPrevious
|
|
760
|
+
href="#"
|
|
761
|
+
onClick={(e) => {
|
|
762
|
+
e.preventDefault();
|
|
763
|
+
if (pagination.hasPreviousPage) {
|
|
764
|
+
handlePageChange(pagination.page - 1);
|
|
765
|
+
}
|
|
766
|
+
}}
|
|
767
|
+
className={cn(
|
|
768
|
+
!pagination.hasPreviousPage &&
|
|
769
|
+
"pointer-events-none opacity-50"
|
|
770
|
+
)}
|
|
771
|
+
/>
|
|
772
|
+
</PaginationItem>
|
|
773
|
+
|
|
774
|
+
{/* Page numbers */}
|
|
775
|
+
{Array.from(
|
|
776
|
+
{ length: Math.max(pagination.totalPages, 1) },
|
|
777
|
+
(_, i) => i + 1
|
|
778
|
+
)
|
|
779
|
+
.filter((page) => {
|
|
780
|
+
const current = pagination.page;
|
|
781
|
+
const total = Math.max(pagination.totalPages, 1);
|
|
789
782
|
return (
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
</PaginationItem>
|
|
794
|
-
<PaginationItem>
|
|
795
|
-
<PaginationLink
|
|
796
|
-
href="#"
|
|
797
|
-
onClick={(e) => {
|
|
798
|
-
e.preventDefault();
|
|
799
|
-
handlePageChange(page);
|
|
800
|
-
}}
|
|
801
|
-
isActive={page === pagination.page}
|
|
802
|
-
>
|
|
803
|
-
{page}
|
|
804
|
-
</PaginationLink>
|
|
805
|
-
</PaginationItem>
|
|
806
|
-
</React.Fragment>
|
|
783
|
+
page === 1 ||
|
|
784
|
+
page === total ||
|
|
785
|
+
(page >= current - 1 && page <= current + 1)
|
|
807
786
|
);
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
if (pagination.hasNextPage) {
|
|
831
|
-
handlePageChange(pagination.page + 1);
|
|
787
|
+
})
|
|
788
|
+
.map((page, index, array) => {
|
|
789
|
+
if (index > 0 && array[index - 1] !== page - 1) {
|
|
790
|
+
return (
|
|
791
|
+
<React.Fragment key={`ellipsis-${page}`}>
|
|
792
|
+
<PaginationItem>
|
|
793
|
+
<PaginationEllipsis />
|
|
794
|
+
</PaginationItem>
|
|
795
|
+
<PaginationItem>
|
|
796
|
+
<PaginationLink
|
|
797
|
+
href="#"
|
|
798
|
+
onClick={(e) => {
|
|
799
|
+
e.preventDefault();
|
|
800
|
+
handlePageChange(page);
|
|
801
|
+
}}
|
|
802
|
+
isActive={page === pagination.page}
|
|
803
|
+
>
|
|
804
|
+
{page}
|
|
805
|
+
</PaginationLink>
|
|
806
|
+
</PaginationItem>
|
|
807
|
+
</React.Fragment>
|
|
808
|
+
);
|
|
832
809
|
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
810
|
+
return (
|
|
811
|
+
<PaginationItem key={page}>
|
|
812
|
+
<PaginationLink
|
|
813
|
+
href="#"
|
|
814
|
+
onClick={(e) => {
|
|
815
|
+
e.preventDefault();
|
|
816
|
+
handlePageChange(page);
|
|
817
|
+
}}
|
|
818
|
+
isActive={page === pagination.page}
|
|
819
|
+
>
|
|
820
|
+
{page}
|
|
821
|
+
</PaginationLink>
|
|
822
|
+
</PaginationItem>
|
|
823
|
+
);
|
|
824
|
+
})}
|
|
825
|
+
|
|
826
|
+
<PaginationItem>
|
|
827
|
+
<PaginationNext
|
|
828
|
+
href="#"
|
|
829
|
+
onClick={(e) => {
|
|
830
|
+
e.preventDefault();
|
|
831
|
+
if (pagination.hasNextPage) {
|
|
832
|
+
handlePageChange(pagination.page + 1);
|
|
833
|
+
}
|
|
834
|
+
}}
|
|
835
|
+
className={cn(
|
|
836
|
+
!pagination.hasNextPage &&
|
|
837
|
+
"pointer-events-none opacity-50"
|
|
838
|
+
)}
|
|
839
|
+
/>
|
|
840
|
+
</PaginationItem>
|
|
841
|
+
</PaginationContent>
|
|
842
|
+
</Pagination>
|
|
843
|
+
</div>
|
|
842
844
|
)}
|
|
843
845
|
</div>
|
|
844
846
|
)}
|