How to use the @material/drawer/dist/mdc.drawer.MDCPersistentDrawerFoundation function in @material/drawer

To help you get started, we’ve selected a few @material/drawer 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 gutenye / react-mc / src / Drawer / PersistentDrawer / PersistentDrawer.js View on Github external
getDefaultFoundation() {
    const { FOCUSABLE_ELEMENTS } = MDCPersistentDrawerFoundation.strings
    this.drawer = this.root_.querySelector(
      MDCPersistentDrawerFoundation.strings.DRAWER_SELECTOR
    )
    // prettier-ignore
    return new MDCPersistentDrawerFoundation({
      addClass: helper.addClass('rootProps', this),
      removeClass: helper.removeClass('rootProps', this),
      hasClass: helper.hasClass('rootProps', this),
      hasNecessaryDom: () => Boolean(this.drawer),
      registerInteractionHandler: (evt, handler) =>
          this.root_.addEventListener(util.remapEvent(evt), handler, util.applyPassive()),
      deregisterInteractionHandler: (evt, handler) =>
          this.root_.removeEventListener(util.remapEvent(evt), handler, util.applyPassive()),
      registerDrawerInteractionHandler: (evt, handler) =>
          this.drawer.addEventListener(util.remapEvent(evt), handler),
      deregisterDrawerInteractionHandler: (evt, handler) =>
          this.drawer.removeEventListener(util.remapEvent(evt), handler),
      registerTransitionEndHandler: helper.registerHandler('rootProps', this, 'transitionend'),
      deregisterTransitionEndHandler: helper.deregisterHandler('rootProps', this, 'transitionend'),
      registerDocumentKeydownHandler: helper.registerHandler(document, 'keydown'),
      deregisterDocumentKeydownHandler: helper.deregisterHandler(document, 'keydown'),