Files
Homarr/src/hooks/useScreenLargerThan.ts

10 lines
421 B
TypeScript
Raw Normal View History

2022-12-10 22:14:31 +01:00
import { MantineSize, useMantineTheme } from '@mantine/core';
import { useMediaQuery } from '@mantine/hooks';
2023-03-21 11:26:19 +08:00
import { MIN_WIDTH_MOBILE } from '../constants/constants';
2022-12-10 22:14:31 +01:00
export const useScreenLargerThan = (size: MantineSize | number) => {
const { breakpoints } = useMantineTheme();
const pixelCount = typeof size === 'string' ? breakpoints[size] : size;
2023-03-21 11:26:19 +08:00
return useMediaQuery(`(min-width: ${MIN_WIDTH_MOBILE})`);
2022-12-10 22:14:31 +01:00
};