refactor: PersonTypeahead — replace compact/large boolean props with size enum #187

Open
opened 2026-04-07 09:06:46 +02:00 by marcel · 0 comments
Owner

Context

The PersonTypeahead component currently uses two boolean props (compact and large) to control input sizing. This results in a nested ternary for the class string that's hard to read and extend:

class={large ? '...' : compact ? '...' : '...'}

Proposed change

Replace compact and large with a single size prop:

size?: 'compact' | 'default' | 'large';

Use a lookup map for the class strings:

const sizeClasses = {
  compact: 'mt-1 block h-9 w-full rounded border ...',
  default: 'mt-1 block w-full rounded-md border ...',
  large: 'mt-2 block h-14 w-full rounded-md border ...',
};

Update all call sites (Briefwechsel person bar, hero, document search advanced filters, person detail pages).

Origin

Flagged by @felixbrandt during PR #186 review — cosmetic cleanup, not blocking.

## Context The `PersonTypeahead` component currently uses two boolean props (`compact` and `large`) to control input sizing. This results in a nested ternary for the class string that's hard to read and extend: ```svelte class={large ? '...' : compact ? '...' : '...'} ``` ## Proposed change Replace `compact` and `large` with a single `size` prop: ```ts size?: 'compact' | 'default' | 'large'; ``` Use a lookup map for the class strings: ```ts const sizeClasses = { compact: 'mt-1 block h-9 w-full rounded border ...', default: 'mt-1 block w-full rounded-md border ...', large: 'mt-2 block h-14 w-full rounded-md border ...', }; ``` Update all call sites (Briefwechsel person bar, hero, document search advanced filters, person detail pages). ## Origin Flagged by @felixbrandt during PR #186 review — cosmetic cleanup, not blocking.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marcel/familienarchiv#187