How to use the react-md/lib/Drawers.getCurrentMedia function in react-md

To help you get started, we’ve selected a few react-md 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 strues / boldr / shared / state / modules / boldr / ui / reducer.js View on Github external
import Drawer from 'react-md/lib/Drawers';
import { LAYOUTS } from '../../../../core/constants';
import * as t from '../../actionTypes';

export const STATE_KEY = 'ui';

function updateDrawerType(state, { drawerType }) {
  if (state.customDrawerType === drawerType) {
    return state;
  }

  return Object.assign({}, state, { customDrawerType: drawerType });
}
const { mobile, tablet, desktop } = Drawer.getCurrentMedia();
let defaultMedia = 'mobile';
if (desktop) {
  defaultMedia = 'desktop';
} else if (tablet) {
  defaultMedia = 'tablet';
}

const INITIAL_STATE = {
  loaded: false,
  layout: LAYOUTS.GRID,
  modal: false,
  drawer: false,
  isMobile: false,
  mobile,
  tablet,
  desktop,