All files / src/theme/hooks useCustomTheme.ts

100% Statements 12/12
100% Branches 2/2
100% Functions 6/6
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35        3173x 2990x   3173x 2990x   3173x 2990x     3173x 2990x     3173x 2990x       3173x   3173x                  
import { Theme, useMediaQuery } from "@mui/material";
import { isMobile } from "@utils/index";
 
export function useCustomTheme() {
  const isExtraLargeView = useMediaQuery((theme: Theme) =>
    theme.breakpoints.up("new_xl"),
  );
  const isLargeView = useMediaQuery((theme: Theme) =>
    theme.breakpoints.up("new_lg"),
  );
  const isMediumView = useMediaQuery(
    (theme: Theme) => theme.breakpoints.down("new_md"),
    { noSsr: true },
  );
  const isMediumSmallView = useMediaQuery(
    (theme: Theme) => theme.breakpoints.down("new_sm_md"),
    { noSsr: true },
  );
  const isMobileView = useMediaQuery(
    (theme: Theme) => theme.breakpoints.down("new_sm"),
    { noSsr: true },
  );
 
  const _isMobile = isMobileView || isMobile;
 
  return {
    isMobileView: _isMobile,
    isDesktopView: !_isMobile,
    isExtraLargeView,
    isMediumView,
    isMediumSmallView,
    isLargeView,
  };
}