Update getBreakpoint.ts

Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
This commit is contained in:
Charles de Dreuille
2025-01-21 11:06:43 +00:00
parent 433e28256f
commit b7353f45d5
+4 -5
View File
@@ -26,11 +26,10 @@ export const breakpoints: { name: string; id: Breakpoint; value: number }[] = [
];
export const getBreakpoint = (): Breakpoint => {
const queries = breakpoints.map(
breakpoint => `(min-width: ${breakpoint.value}px)`,
);
const matches = queries.map(query => useMediaQuery(query));
const matches = breakpoints.map(breakpoint => {
const match = useMediaQuery(`(min-width: ${breakpoint.value}px)`);
return match;
});
for (let i = matches.length - 1; i >= 0; i--) {
if (matches[i]) {