Skip to content

feat: add useMediaQuery hook for responsive component behavior (#122) - #231

Closed
bbkenny wants to merge 3 commits into
AudioBitsStellar:mainfrom
bbkenny:fix/audio-blocks-122-use-media-query
Closed

feat: add useMediaQuery hook for responsive component behavior (#122)#231
bbkenny wants to merge 3 commits into
AudioBitsStellar:mainfrom
bbkenny:fix/audio-blocks-122-use-media-query

Conversation

@bbkenny

@bbkenny bbkenny commented Aug 3, 2026

Copy link
Copy Markdown

Closes #122

Summary

Added a useMediaQuery hook for reactive media query matching, enabling responsive component behavior beyond CSS media queries.

What changed

  • New hooks/useMediaQuery.ts:

    • useMediaQuery(query, options?) — accepts a media query string, returns a boolean
    • SSR-safe: returns defaultValue (false) during hydration
    • Reactive updates via matchMedia change events (no resize listeners, no layout thrashing)
    • Cleans up event listeners on unmount
    • Supports multiple simultaneous queries
  • Export helpers:

    • useIsMobile()(max-width: 767px)
    • useIsTablet()(min-width: 768px) and (max-width: 1023px)
    • useIsDesktop()(min-width: 1024px)

Acceptance Criteria

  • ✅ Accepts media query string, returns boolean
  • ✅ SSR-safe: returns defaultValue during hydration
  • ✅ Updates reactively when viewport changes
  • ✅ Cleans up event listener on unmount
  • ✅ Supports multiple simultaneous queries
  • ✅ No layout thrashing (uses matchMedia, not resize events)

Verification

  • npm run lint — no new warnings or errors
  • npm run test — 170/170 tests pass
  • npm run build — builds successfully

…ioBitsStellar#124)

- Add hooks/useSearchHistory.ts hook for managing search history in localStorage
- Max 20 unique searches stored, deduplicated, sorted by recency
- Integrate useSearchHistory into SearchOverlay component
- Show recent searches as dropdown when search input is empty
- Allow clicking on a suggestion to populate and submit the search
- Add clear history button with Trash2 icon
- Each search query saved with timestamp
…ng (AudioBitsStellar#123)

- Create context/TransactionContext.tsx with transaction state management
- Track transactions with { id, hash, type, status, timestamp }
- Support addTransaction, updateTransactionStatus, clearTransaction, clearAllTransactions
- Auto-poll transaction status every 2 seconds
- Show toast notifications for pending, confirmed, and failed transactions
- Auto-clear confirmed transactions after 60 seconds
- Transaction history limited to last 20 entries
- Add TransactionProvider to the provider chain in provider.tsx
…BitsStellar#122)

- Add hooks/useMediaQuery.ts with reactive media query matching
- Uses window.matchMedia API (no layout thrashing)
- SSR-safe: returns defaultValue during hydration
- Updates reactively when viewport changes
- Cleans up event listener on unmount
- Supports multiple simultaneous queries
- Export helpers: useIsMobile, useIsTablet, useIsDesktop
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

@thebabalola is attempting to deploy a commit to the akatenvictor's projects Team on Vercel.

A member of the Team first needs to authorize it.

@bbkenny bbkenny closed this Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create useMediaQuery hook for responsive component behavior

2 participants