Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add toggle to MobileMenu #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NullVoxPopuli
Copy link

Use case: keyboard shortcuts! :D

<MobileMenuWrapper @openDetectonWidth={{30}} as |mmw|>

  {{#if this.currentUser.isLoggedIn}}
    <mmw.MobileMenu
      @isOpen={{this.sidebar.isOpen}}
      @onToggle={{this.sidebar.toggle}}
    as |mm|>

      <App::Sidebar
        class='sidebar-wrapper'
        id='sidebar'
        {{on-key 'ctrl+space' this.sidebar.toggle}}
      />

    </mmw.MobileMenu>
  {{/if}}

  <mmw.Content>
    {{yield}}
  </mmw.Content>
</MobileMenuWrapper>

Use case: keyboard shortcuts! :D 

```hbs
<MobileMenuWrapper @openDetectonWidth={{30}} as |mmw|>

  {{#if this.currentUser.isLoggedIn}}
    <mmw.MobileMenu
      @isopen={{this.sidebar.isOpen}}
      @onToggle={{this.sidebar.toggle}}
    as |mm|>

      <App::Sidebar
        class='sidebar-wrapper'
        id='sidebar'
        {{on-key 'ctrl+space' this.sidebar.toggle}}
      />

    </mmw.MobileMenu>
  {{/if}}

  <mmw.Content>
    {{yield}}
  </mmw.Content>
</MobileMenuWrapper>
```
@nickschot nickschot added the enhancement New feature or request label Aug 3, 2020
@nickschot
Copy link
Owner

@NullVoxPopuli this current implementation will unfortunately not work as openOrClose does not function as a toggle action, it requires an argument which states whether the menu should open or not. We could pass that in with an if statement or create a separate toggle action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants