Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix ugly pagination per page selector shift

Blue Mouse97199ce0f621
diff --git a/web/app/ui/Pagination.tsx b/web/app/ui/Pagination.tsx
index 584333ccd..4f49fe32b 100644
--- a/web/app/ui/Pagination.tsx
+++ b/web/app/ui/Pagination.tsx
@@ -91,13 +91,17 @@ const Pagination = ({
</p>
<div className='flex items-center gap-4'>
{pageSizeOptions && onPageSizeChange ? (
- <Select<string>
- label={t('common.resultsPerPage')}
- title={pageSize.toString()}
- items={processedPageSizeOptions}
- onSelect={(item) => onPageSizeChange(Number(item))}
- labelClassName='!overflow-visible'
- />
+ <div className='flex items-center gap-2'>
+ <span className='text-sm text-gray-700 dark:text-gray-200'>{t('common.resultsPerPage')}</span>
+ <Select<string>
+ label={t('common.resultsPerPage')}
+ fieldLabelClassName='sr-only'
+ title={pageSize.toString()}
+ items={processedPageSizeOptions}
+ onSelect={(item) => onPageSizeChange(Number(item))}
+ labelClassName='!overflow-visible'
+ />
+ </div>
) : null}
<nav className='isolate inline-flex -space-x-px rounded-md' aria-label='Pagination'>
<button
diff --git a/web/app/ui/Select.tsx b/web/app/ui/Select.tsx
index a534fcd10..fe6f2b01f 100644
--- a/web/app/ui/Select.tsx
+++ b/web/app/ui/Select.tsx
@@ -17,6 +17,8 @@ interface SelectProps<T> {
label?: string
hint?: string | React.ReactNode
className?: string
+ // Optional className to customise the top field label (not the option labels)
+ fieldLabelClassName?: string
labelClassName?: string
buttonClassName?: string
capitalise?: boolean
@@ -42,6 +44,7 @@ function Select<T>({
buttonClassName,
capitalise,
labelClassName,
+ fieldLabelClassName,
}: SelectProps<T>) {
return (
// @ts-expect-error
@@ -49,7 +52,12 @@ function Select<T>({
{({ open }) => (
<>
{label ? (
- <Label className='mb-1 block text-sm font-medium whitespace-pre-line text-gray-700 dark:text-gray-100'>
+ <Label
+ className={cx(
+ 'mb-1 block text-sm font-medium whitespace-pre-line text-gray-700 dark:text-gray-100',
+ fieldLabelClassName,
+ )}
+ >
{label}
</Label>
) : null}