Hide next/prev button when no pages are availables

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-03-13 07:24:44 +01:00
parent e12ca7406c
commit 3fc73adabd
2 changed files with 17 additions and 2 deletions

View File

@@ -90,12 +90,16 @@ function LoadAboveButton({
hasMore: boolean; hasMore: boolean;
onLoadMore: () => void; onLoadMore: () => void;
}) { }) {
if (!hasMore) {
return null;
}
return ( return (
<div className="flex justify-center"> <div className="flex justify-center">
<Button <Button
variant="outline" variant="outline"
onClick={onLoadMore} onClick={onLoadMore}
disabled={isLoading || !hasMore} disabled={isLoading}
className="w-full" className="w-full"
> >
{isLoading ? "Loading..." : "Load above"} {isLoading ? "Loading..." : "Load above"}
@@ -113,6 +117,10 @@ function LoadBelowButton({
hasMore: boolean; hasMore: boolean;
onLoadMore: () => void; onLoadMore: () => void;
}) { }) {
if (!hasMore) {
return null;
}
return ( return (
<div className="flex justify-center"> <div className="flex justify-center">
<Button <Button
@@ -170,7 +178,6 @@ function PeopleListContent({
</div> </div>
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<p className="text-muted-foreground">1 people needs to get onboarded</p>
<Button <Button
asChild asChild
variant="outline" variant="outline"

View File

@@ -143,6 +143,10 @@ function LoadAboveButton({
hasMore: boolean; hasMore: boolean;
onLoadMore: () => void; onLoadMore: () => void;
}) { }) {
if (!hasMore) {
return null;
}
return ( return (
<div className="flex justify-center"> <div className="flex justify-center">
<Button <Button
@@ -166,6 +170,10 @@ function LoadBelowButton({
hasMore: boolean; hasMore: boolean;
onLoadMore: () => void; onLoadMore: () => void;
}) { }) {
if (!hasMore) {
return null;
}
return ( return (
<div className="flex justify-center"> <div className="flex justify-center">
<Button <Button