Skip to content

UI kit: Toast, and move the snackbar context off MUI #2267

Open

Description

@trillium

Trillium Firstmate 🤖

Overview

Replace MUI Snackbar + Alert + Slide in client/src/context/snackbarContext.jsx with a Tailwind toast, keeping the useSnackbar() API so no calling code changes.

Dependencies

Action Items

  • Create client/src/components/ui/toast.tsx (Radix Toast, or a small hand-written component; see Additional Notes) showing a message with severity (success, error, warning, info), a close button, bottom-right placement, a 7 second auto-hide, and a slide-in/out animation that respects prefers-reduced-motion.
  • Rewrite context/snackbarContext.jsx so SnackbarProvider and useSnackbar() keep the same shape: showSnackbar(message, severity) and hideSnackbar().
  • The two current callers must work without edits: components/manageProjects/editMeetingTimes.jsx and components/manageProjects/createNewEvent.jsx. Check them by hand and describe it in the PR.
  • Tests: showing a message renders it with role status/alert, it disappears after the timeout (use fake timers), close button works, the severity changes the color.
  • Catalogue entry for each severity.

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.
  • useSnackbar() callers are unchanged, and context/snackbarContext.jsx no longer imports @mui/*.

Resources/Instructions

Additional Notes

  • Decision needed: toast implementation. Proposed default: Radix Toast. A hand-written toast is enough for one message at a time and avoids another dependency; either is acceptable.
  • This ticket edits one existing file (the context) because that is the only way to swap the component without a second ticket.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions