Add leaflet-powered brewery map

This commit is contained in:
Aaron Po
2026-08-26 03:40:11 -04:00
parent 4ca35de7ef
commit d6306cbcba
11 changed files with 306 additions and 20 deletions

View File

@@ -0,0 +1,22 @@
import { useSyncExternalStore } from 'react';
const subscribe = (query: string) => (callback: () => void) => {
const media = window.matchMedia(query);
media.addEventListener('change', callback);
return () => media.removeEventListener('change', callback);
};
/**
* Tracks whether a CSS media query currently matches the viewport, updating on change.
*
* @example
* const isSmallScreen = useMediaQuery('(max-width: 640px)');
*/
const useMediaQuery = (query: `(${string})`) =>
useSyncExternalStore(
subscribe(query),
() => window.matchMedia(query).matches,
() => false,
);
export default useMediaQuery;