fix: load more button overflow

This commit is contained in:
DIYgod
2023-06-10 00:18:18 +01:00
parent d3116e0fce
commit 4e956cd24b
2 changed files with 32 additions and 27 deletions
+18 -16
View File
@@ -145,22 +145,24 @@ export default function PostList({
</div>
)}
{posts.hasNextPage && (
<Button
className="mt-8 mx-auto !flex"
variant="outline"
onClick={() => posts.fetchNextPage()}
isLoading={posts.isFetchingNextPage}
aria-label="load more"
>
{t("load more", {
ns: "site",
name: t(
"post" +
(posts.data?.pages[0].count - currentLength > 1 ? "s" : ""),
),
count: posts.data?.pages[0].count - currentLength,
})}
</Button>
<div className="text-center">
<Button
className="mt-8 truncate max-w-full !inline-block"
variant="outline"
onClick={() => posts.fetchNextPage()}
isLoading={posts.isFetchingNextPage}
aria-label="load more"
>
{t("load more", {
ns: "site",
name: t(
"post" +
(posts.data?.pages[0].count - currentLength > 1 ? "s" : ""),
),
count: posts.data?.pages[0].count - currentLength,
})}
</Button>
</div>
)}
</>
)
+14 -11
View File
@@ -145,17 +145,20 @@ export const SiteArchives = () => {
)
})}
{posts.hasNextPage && (
<Button
className="mt-8 mx-auto !flex"
variant="outline"
onClick={() => posts.fetchNextPage()}
isLoading={posts.isFetchingNextPage}
aria-label="load more"
>
There are {posts.data?.pages[0].count - currentLength} more post
{posts.data?.pages[0].count - currentLength > 1 ? "s" : ""},
click to load more
</Button>
<div className="text-center">
<Button
className="mt-8 truncate max-w-full !inline-block"
variant="outline"
onClick={() => posts.fetchNextPage()}
isLoading={posts.isFetchingNextPage}
aria-label="load more"
>
There are {posts.data?.pages[0].count - currentLength} more
post
{posts.data?.pages[0].count - currentLength > 1 ? "s" : ""},
click to load more
</Button>
</div>
)}
</div>
</>