How to use the @material-ui/core.useMediaQuery function in @material-ui/core

To help you get started, we’ve selected a few @material-ui/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / DLWorkspace / src / dashboard / src / pages / Job / Details / index.tsx View on Github external
}
  const { teams } = React.useContext(TeamContext);
  const [isReady, reset, cancel] = useTimeoutFn(() => {
    setRefresh(true);
    setShowIframe(true)
  }, 2000);
  const isReadOnly = teams.filter((item: any)=>item["id"] === team)[0]["clusters"].filter((cluster: any) => cluster.id === clusterId)[0].admin || email === job['userName'];
  useEffect(()=>{
    if (isReady()) {
      reset();
    }
    return () => {
      cancel()
    }
  },[])
  const isDesktop = useMediaQuery(theme.breakpoints.up("sm"));
  const [showOpen, setshowOpen] = useState(false)
  const handleWarnClose = () => {
    setshowOpen(false)
  }

  if (!isReadOnly) {
    return (
github navidrome / navidrome / ui / src / album / AlbumActions.js View on Github external
const AlbumActions = ({
  className,
  ids,
  data,
  record,
  permanentFilter,
  ...rest
}) => {
  const dispatch = useDispatch()
  const translate = useTranslate()
  const classes = useStyles()
  const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md'))
  const isNotSmall = useMediaQuery((theme) => theme.breakpoints.up('sm'))

  const handlePlay = React.useCallback(() => {
    dispatch(playTracks(data, ids))
  }, [dispatch, data, ids])

  const handlePlayNext = React.useCallback(() => {
    dispatch(playNext(data, ids))
  }, [dispatch, data, ids])

  const handlePlayLater = React.useCallback(() => {
    dispatch(addTracks(data, ids))
  }, [dispatch, data, ids])

  const handleShuffle = React.useCallback(() => {
    dispatch(shuffleTracks(data, ids))
  }, [dispatch, data, ids])
github quiltdata / quilt / catalog / app / containers / NavBar / NavBar.js View on Github external
export function NavBar() {
  const cfg = Config.use()
  const bucket = BucketConfig.useCurrentBucket()
  const { paths } = NamedRoutes.use()
  const notSignIn = !useRoute(paths.signIn, { exact: true }).match
  const selector = React.useCallback(
    createStructuredSelector(
      R.pick(['error', 'waiting', 'authenticated'], authSelectors),
    ),
    [],
  )
  const { error, waiting, authenticated } = reduxHook.useMappedState(selector)
  const t = M.useTheme()
  const useHamburger = M.useMediaQuery(t.breakpoints.down('sm'))
  const links = useLinks()
  return (
    
      {cfg.disableNavigator ? (
        
      ) : (
        
      )}
      {!useHamburger && (
        
          {links.map(({ label, ...rest }) => (
            
              {label}
            
          ))}
github denoland / deno_website2 / src / hook / theme.ts View on Github external
export const useDarkMode = () => useMediaQuery("(prefers-color-scheme: dark)");
github quiltdata / quilt / catalog / app / containers / Bucket / PackageList.js View on Github external
function SortDropdown({ value, options, makeSortUrl }) {
  const t = M.useTheme()
  const xs = M.useMediaQuery(t.breakpoints.down('xs'))
  const classes = useSortDropdownStyles()
  const [anchor, setAnchor] = React.useState(null)
  const open = React.useCallback(
    (evt) => {
      setAnchor(evt.target)
    },
    [setAnchor],
  )
  const close = React.useCallback(() => {
    setAnchor(null)
  }, [setAnchor])

  const selected = getSort(value)

  return (
    <>
github navidrome / navidrome / ui / src / artist / ArtistListActions.js View on Github external
const ArtistListActions = ({ className, ...rest }) => {
  const isNotSmall = useMediaQuery((theme) => theme.breakpoints.up('sm'))

  return (
    
      {isNotSmall && }
    
  )
}
github hackoregon / civic / packages / component-library / stories / CivicCard.story.js View on Github external
function SampleCardVisualizationWithSelector({ isLoading, data }) {
  const isDesktop = useMediaQuery("(min-width:640px)");
  const grpLabel = "Bus Line";
  const radioLabels = ["14", "72", "20"];
  const [busRoute, setBusRoute] = useState("14");
  const domain = {
    x: [2009, 2017],
    y: [0, 20000]
  };
  return (
    !isLoading &&
    data && (
      <>
github cloudkeeper-io / cloudkeeper-ui / src / components / layout / drawer-layout / drawer-layout.component.tsx View on Github external
export default memo(({ children }: DrawerLayoutProps) => {
  const { location: { pathname } } = useReactRouter()
  const { isExpanded, setExpanded } = useContext(AppBarContext)
  const { user } = useContext(UserContext)
  const [isOpen, setOpen] = useState(false)
  const { error, currentTenant } = useContext(TenantContext)
  const isMobile = useMediaQuery(`(${mobileMediaQuery})`)

  const toggleExpand = useCallback(() => setExpanded(!isExpanded), [isExpanded, setExpanded])
  const openSidebar = useCallback(() => setOpen(true), [setOpen])
  const closeSidebar = useCallback(() => setOpen(false), [setOpen])

  useEffect(closeSidebar, [pathname])
  useEffect(() => {
    if (user!.isAnonymous) {
      toast((
        <div>You're in the demo mode.
            You can sign up here 
            or do it later using buttons in header
        </div>
      ),
      { position: 'top-center', autoClose: false })
    }
github jhackshaw / tspvis / src / components / MapPlot.jsx View on Github external
const MapPlot = React.forwardRef((props, ref) => {
  const theme = useTheme();
  const matches = useMediaQuery(theme.breakpoints.down('sm'));
  const mapGlRef = useRef();
  const plotPoints = useSelector(selectors.selectPointsDisplay);
  const plotPaths = useSelector(selectors.selectPlotPaths);
  const viewport = useSelector(selectors.selectViewport);
  const running = useSelector(selectors.selectRunning);
  const definingPoints = useSelector(selectors.selectDefiningPoints)
  const dispatch = useDispatch()


  useImperativeHandle(ref, () => ({
    getBounds: () => {
      const map = mapGlRef.current.getMap();
      const { _ne, _sw } = map.getBounds();
      return {
        top: _ne.lat,
        bottom: _sw.lat,
github chaos-mesh / chaos-mesh / ui / src / components / TopContainer / index.tsx View on Github external
const TopContainer = () =&gt; {
  const theme = useTheme()
  const isTabletScreen = useMediaQuery(theme.breakpoints.down('sm'))
  const isMobileScreen = useMediaQuery(theme.breakpoints.down('xs'))
  const classes = useStyles()

  const { pathname } = useLocation()

  const { settings, globalStatus, navigation } = useStoreSelector((state) =&gt; state)
  const { theme: settingsTheme, lang } = settings
  const { alert, alertOpen } = globalStatus
  const { breadcrumbs } = navigation

  const globalTheme = useMemo(() =&gt; (settingsTheme === 'light' ? customTheme : customDarkTheme), [settingsTheme])
  const intlMessages = useMemo&gt;(() =&gt; flat(messages[lang]), [lang])

  const dispatch = useStoreDispatch()
  const handleSnackClose = () =&gt; dispatch(setAlertOpen(false))