♻️ Refactor hooks

This commit is contained in:
Manuel Ruwe
2022-12-23 17:29:58 +01:00
parent f3b601dc2d
commit c84d8b59fe
15 changed files with 17 additions and 17 deletions

View File

@@ -0,0 +1,8 @@
import { MantineSize, useMantineTheme } from '@mantine/core';
import { useMediaQuery } from '@mantine/hooks';
export const useScreenLargerThan = (size: MantineSize | number) => {
const { breakpoints } = useMantineTheme();
const pixelCount = typeof size === 'string' ? breakpoints[size] : size;
return useMediaQuery(`(min-width: ${pixelCount}px)`);
};