Skip to content

UI kit: month/year picker (popover grid) to replace the MUI X DatePicker #2272

Open

Description

@trillium

Trillium Firstmate 🤖

Overview

Create the month/year picker that replaces the only MUI X DatePicker in the app, used for "how long have you been volunteering" in the new-volunteer check-in form. Decided: it is a popover with a month grid and year arrows (no typed entry).

Dependencies

Action Items

  • Add @radix-ui/react-popover and add date-fns as a direct dependency (the app imports date-fns in pages/CheckInForm.jsx today but only gets it indirectly through @mui/x-date-pickers, which will be removed).
  • Create client/src/components/ui/month-year-picker.tsx: an input-style button that shows the chosen month/year (for example "Mar 2019"), opens a popover with previous/next year arrows and a 12-month grid, and supports value: Date, onChange(date), minDate and maxDate (disabled months outside the range), label, error, disabled.
  • Today's usage for reference (components/presentational/newUserForm.jsx): minDate = Jan 2013, maxDate = now, default value = now. Match these defaults in the screen ticket.
  • Keyboard: Tab to the button, Enter/Space opens, arrow keys move between months, Page Up/Down change year, Enter selects and closes, Escape closes and returns focus. Months out of range are not selectable.
  • Tests: opens/closes, selecting calls onChange with the first day of that month, min/max disable months and block year navigation past the limits, keyboard flow above.
  • Catalogue entry (closed, open, disabled, error, min/max).

Acceptance Criteria

  • The component lives in client/src/components/ui/ as a .tsx file, with typed props that pass yarn typecheck (strict mode).
  • Styling uses Tailwind classes only. Variants (if any) are declared with cva, and className is merged with cn() so callers can override.
  • The component does not import anything from @mui/* or @emotion/*.
  • A test file next to the component (for example button.test.tsx) covers: it renders, each variant/size, the disabled and error states where they apply, and keyboard use where it applies (Tab, Enter/Space, Escape, arrow keys). yarn test passes.
  • The component has an entry on the /design-system page: description, props/variants, states, a short do/don't, a code example, and a live demo.
  • Visible focus: there is a clear focus ring when the control is reached by keyboard.
  • The PR does not change any existing screen. Screens adopt the component in their own tickets.

Resources/Instructions

Additional Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature: Design systemmilestone: missingrole: Front Endsize: 3pt

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions