UNPKG

@hitachivantara/uikit-react-core

Version:

Core React components for the NEXT Design System.

15 lines (14 loc) 477 B
import { useTheme } from "@mui/material/styles"; import useMediaQuery from "@mui/material/useMediaQuery"; import { theme } from "@hitachivantara/uikit-styles"; const useWidth = () => { const muiTheme = useTheme(); const keys = Object.keys(theme.breakpoints.values).reverse(); return keys.reduce((output, key) => { const matches = useMediaQuery(muiTheme.breakpoints.up(key)); return !output && matches ? key : output; }, null) || "xs"; }; export { useWidth };