Skip to content

Add helper for detecting if the current device is a mobile viewport #481

Description

@Chucks1093

Summary

Several UI decisions (tooltip vs toast, collapsed vs expanded nav) depend on whether the user is on a mobile viewport. A shared helper that reads the window width and returns a boolean should be used consistently instead of inline media query checks scattered across components.

Scope

  • Add useIsMobile(): boolean React hook using a window.matchMedia listener with a 768px breakpoint
  • Hook updates correctly when the viewport is resized
  • Cleans up the media query listener on unmount
  • Add unit tests mocking window.matchMedia for mobile and desktop widths

Acceptance Criteria

  • Returns true for viewport width below 768px
  • Returns false for viewport width at or above 768px
  • Updates correctly on viewport resize
  • Listener is cleaned up on unmount

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions