import { Button, LinkButton } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { buildPageHref } from "@/modules/settings/lib/pagination"; type TableToolbarProps = { actionLabel?: string; pathname: string; query: string; searchPlaceholder: string; total: number; }; export function TableToolbar({ actionLabel, pathname, query, searchPlaceholder, total, }: TableToolbarProps): React.ReactElement { return (
{actionLabel ?? `共 ${total} 条`}
); } type TablePaginationProps = { page: number; pageCount: number; pathname: string; query: string; total: number; }; export function TablePagination({ page, pageCount, pathname, query, total, }: TablePaginationProps): React.ReactElement { const safePage = Math.min(page, pageCount); const isFirstPage = safePage <= 1; const isLastPage = safePage >= pageCount; return (
共 {total} 条
{isFirstPage ? ( ) : ( 首页 )} {isFirstPage ? ( ) : ( 上一页 )} {safePage}/{pageCount}
{query.trim() ? : null}
{isLastPage ? ( ) : ( 下一页 )} {isLastPage ? ( ) : ( 末页 )}
); }