mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
fix: keep usage details pagination inside mobile viewport (#1218)
On viewports below 640px the pagination row at Dashboard > Usage > Details rendered the rows-per-page select plus the full numbered page list plus the prev/next chevrons in one unwrapped flex row with no horizontal padding. On a 390px phone the Rows: label was clipped on the left and the next chevron was clipped on the right. Add px-2 to the outer container so the pagination card has horizontal breathing room. Switch the inner controls group to flex-wrap with gap-2 on mobile (and gap-4 from sm: up) so the rows-per-page select can wrap below the chevrons. Hide the numbered page buttons, the 1 / last anchors, and the ... ellipses below sm: -- only the prev, current page indicator, and next chevrons render on mobile, which keeps every control reachable while fitting inside the card. Desktop layout (>= 640px) is unchanged. Refs decolua/9router#1146
This commit is contained in:
@@ -37,7 +37,7 @@ export default function Pagination({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex flex-col sm:flex-row items-center justify-between gap-4 py-4",
|
"flex flex-col sm:flex-row items-center justify-between gap-4 py-4 px-2",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
@@ -50,7 +50,7 @@ export default function Pagination({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex flex-wrap items-center justify-center gap-2 sm:gap-4">
|
||||||
{/* Page size selector */}
|
{/* Page size selector */}
|
||||||
{onPageSizeChange && (
|
{onPageSizeChange && (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
@@ -92,12 +92,12 @@ export default function Pagination({
|
|||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => onPageChange(1)}
|
onClick={() => onPageChange(1)}
|
||||||
className="w-9 px-0"
|
className="w-9 px-0 hidden sm:inline-flex"
|
||||||
>
|
>
|
||||||
1
|
1
|
||||||
</Button>
|
</Button>
|
||||||
{pageNumbers[0] > 2 && (
|
{pageNumbers[0] > 2 && (
|
||||||
<span className="text-text-muted px-1">...</span>
|
<span className="text-text-muted px-1 hidden sm:inline">...</span>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -108,7 +108,10 @@ export default function Pagination({
|
|||||||
variant={currentPage === page ? "primary" : "ghost"}
|
variant={currentPage === page ? "primary" : "ghost"}
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => onPageChange(page)}
|
onClick={() => onPageChange(page)}
|
||||||
className="w-9 px-0"
|
className={cn(
|
||||||
|
"w-9 px-0",
|
||||||
|
currentPage === page ? "inline-flex" : "hidden sm:inline-flex"
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
{page}
|
{page}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -117,13 +120,13 @@ export default function Pagination({
|
|||||||
{pageNumbers[pageNumbers.length - 1] < totalPages && (
|
{pageNumbers[pageNumbers.length - 1] < totalPages && (
|
||||||
<>
|
<>
|
||||||
{pageNumbers[pageNumbers.length - 1] < totalPages - 1 && (
|
{pageNumbers[pageNumbers.length - 1] < totalPages - 1 && (
|
||||||
<span className="text-text-muted px-1">...</span>
|
<span className="text-text-muted px-1 hidden sm:inline">...</span>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => onPageChange(totalPages)}
|
onClick={() => onPageChange(totalPages)}
|
||||||
className="w-9 px-0"
|
className="w-9 px-0 hidden sm:inline-flex"
|
||||||
>
|
>
|
||||||
{totalPages}
|
{totalPages}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user