How to use the @material/menu.MDCSimpleMenu function in @material/menu

To help you get started, we’ve selected a few @material/menu 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 GoogleChromeLabs / sample-currency-converter / scripts / main.js View on Github external
.then(() => new this._viewClasses.SelectView(this, this._model,
            this._screens.select, this._animationHelper));

    this._settingsViewPromise = import('./views/settings.js')
        .then((module) => this._viewClasses.SettingsView = module.SettingsView)
        .then(() => this._booted)
        .then(() => new this._viewClasses.SettingsView(this, this._model,
            this._screens.settings, this._animationHelper));

    this._booted.then(() => this._hideLoadingScreen());

    // MDC-Web component init.

    MDCRipple.attachTo(document.querySelector('.mm-convert__update'));
    const menu =
        new MDCSimpleMenu(document.querySelector('.mdc-toolbar__menu'));

    this._snackbar = new MDCSnackbar(document.querySelector('.mm-snackbar'));

    // Add event listener to button to toggle the menu on and off.
    this._elements.more.addEventListener('click', () =>
        this._booted.then(() => (menu.open = !menu.open)));

    // Add event listener to open Settings screen.
    document.querySelector('.mm-menu__settings').addEventListener('click',
        () => this._settingsViewPromise.then((view) => {
          view.show(this._screens.convert);
          history.pushState({page: 'settings'}, 'Settings');
        }));

    const ratesDialog =
        new MDCDialog(document.querySelector('#mm-rates-dialog'));
github material-components / material-components-web / packages / mdc-select / index.js View on Github external
  initialize(menuFactory = (el) => new MDCSimpleMenu(el)) {
    this.menuEl_ = this.root_.querySelector('.mdc-select__menu');
github prateekbh / preact-material-components / Menu / index.js View on Github external
componentDidMount() {
    this.MDComponent = new MDCSimpleMenu(this.control);
  }
  componentWillUnmount() {