Skip to content

Commit

Permalink
fix: species/length filter input and buttons layout
Browse files Browse the repository at this point in the history
Fixes #246
  • Loading branch information
stdavis committed Nov 29, 2024
1 parent fc115fa commit 82800a5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/components/filters/SpeciesLength.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ function RowControls({ species, min, max, onChange, addRow, removeRow, isLast }:
);
}

const iconClasses = 'w-5 text-zinc-700 dark:text-zinc-50';
const buttonClasses = 'p-0';

return (
<>
<div className="flex w-full items-end gap-1">
Expand All @@ -52,27 +55,27 @@ function RowControls({ species, min, max, onChange, addRow, removeRow, isLast }:
)}
<TextField
label="Min"
className="min-w-0 flex-grow"
className="min-w-0 flex-1"
value={min}
type="number"
isInvalid={(min.length && !isPositiveWholeNumber(min)) || isInvalidRange}
onChange={(newValue: string) => onChange({ species, min: newValue, max })}
/>
<TextField
label="Max"
className="min-w-0 flex-grow"
className="min-w-0 flex-1"
value={max}
type="number"
isInvalid={(max.length && !isPositiveWholeNumber(max)) || isInvalidRange}
onChange={(newValue: string) => onChange({ species, min, max: newValue })}
/>
{isLast ? (
<Button aria-label="add new filter" variant="icon" className="w-16" onPress={addRow}>
<PlusCircleIcon />
<Button aria-label="add new filter" variant="icon" onPress={addRow} className={buttonClasses}>
<PlusCircleIcon className={iconClasses} />
</Button>
) : (
<Button aria-label="remove this filter" variant="icon" className="w-16" onPress={removeRow}>
<MinusCircleIcon />
<Button aria-label="remove this filter" variant="icon" onPress={removeRow} className={buttonClasses}>
<MinusCircleIcon className={iconClasses} />
</Button>
)}
</div>
Expand Down

0 comments on commit 82800a5

Please sign in to comment.