Skip to content

Commit

Permalink
Merge pull request #821 from nickschot/drop-link-to
Browse files Browse the repository at this point in the history
Drop support for mm.LinkTo component, use LinkTo with on click modifier instead
  • Loading branch information
nickschot authored Dec 1, 2023
2 parents 332703b + 6f0c33e commit e40b579
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 93 deletions.
10 changes: 5 additions & 5 deletions docs/app/templates/docs/components/menu-wrapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ By default it is set up to detect a pan from respectively the left or the right
```handlebars
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand All @@ -30,7 +30,7 @@ By default the menu is setup to be a left menu. By passing `type=right` to the m
```handlebars
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu @type="right" as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand All @@ -45,7 +45,7 @@ You can also use both a left and a right menu. A `target` option is available on
```handlebars
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu @type="left" as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand All @@ -54,7 +54,7 @@ You can also use both a left and a right menu. A `target` option is available on
</mmw.Content>
<mmw.MobileMenu @type="right" as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
</MobileMenuWrapper>
```
Expand All @@ -68,7 +68,7 @@ If a menu is _not_ embedded, the assumption is made that the `Content` component
<demo.example @name="menu-quickstart.hbs" class="demo-height">
<MobileMenuWrapper @embed={{true}} as |mmw|>
<mmw.MobileMenu as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>

<mmw.Content>
Expand Down
2 changes: 1 addition & 1 deletion docs/app/templates/docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ To get started the `<MobileMenuWrapper/>` component needs to be placed high in t
```handlebars
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand Down
2 changes: 1 addition & 1 deletion docs/app/templates/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<div class="mobile-menu__body">
<ul class="mobile-menu__nav">
<li class="mobile-menu__nav-item">
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</li>
</ul>
</div>
Expand Down
2 changes: 0 additions & 2 deletions ember-mobile-menu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"test": "echo 'A v2 addon does not have tests, run tests in test-app'"
},
"dependencies": {
"@ember/legacy-built-in-components": "^0.5.0",
"@ember/render-modifiers": "^2.0.0",
"@ember/test-waiters": "^3.0.0",
"@embroider/addon-shim": "^1.0.0",
Expand Down Expand Up @@ -95,7 +94,6 @@
"./components/mobile-menu-wrapper.js": "./dist/_app_/components/mobile-menu-wrapper.js",
"./components/mobile-menu-wrapper/content.js": "./dist/_app_/components/mobile-menu-wrapper/content.js",
"./components/mobile-menu.js": "./dist/_app_/components/mobile-menu.js",
"./components/mobile-menu/link-to.js": "./dist/_app_/components/mobile-menu/link-to.js",
"./components/mobile-menu/mask.js": "./dist/_app_/components/mobile-menu/mask.js",
"./components/mobile-menu/tray.js": "./dist/_app_/components/mobile-menu/tray.js"
}
Expand Down
1 change: 0 additions & 1 deletion ember-mobile-menu/src/components/mobile-menu.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
>
{{yield
(hash
LinkTo=(component "mobile-menu/link-to" onClick=this.closeFromLinkTo)
actions=(hash
open=this.open
close=this.close
Expand Down
29 changes: 0 additions & 29 deletions ember-mobile-menu/src/components/mobile-menu/link-to.js

This file was deleted.

10 changes: 7 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 18 additions & 18 deletions test-app/tests/integration/components/mobile-menu-wrapper-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
</MobileMenuWrapper>
`);
Expand All @@ -39,7 +39,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu @type="right" as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
</MobileMenuWrapper>
`);
Expand All @@ -52,7 +52,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand Down Expand Up @@ -80,7 +80,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu @type="right" as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand All @@ -101,10 +101,10 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu @type="left" as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.MobileMenu @type="right" as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand Down Expand Up @@ -135,7 +135,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand All @@ -160,7 +160,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand All @@ -180,7 +180,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu @type="right" as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand All @@ -200,7 +200,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand All @@ -220,7 +220,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand All @@ -241,7 +241,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand All @@ -264,7 +264,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
<div class="root-div" style="padding: 100px; height: 500px; background: red;">
<MobileMenuWrapper @embed={{true}} as |mmw|>
<mmw.MobileMenu as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand Down Expand Up @@ -296,7 +296,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
<div class="root-div" style="padding: 100px; height: 500px; background: red;">
<MobileMenuWrapper @embed={{true}} as |mmw|>
<mmw.MobileMenu @type="right" as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand Down Expand Up @@ -326,7 +326,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper @embed={{true}} as |mmw|>
<mmw.MobileMenu as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand All @@ -347,7 +347,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand All @@ -370,7 +370,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu @width={{100}} @maxWidth={{this.maxWidth}} as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand Down Expand Up @@ -403,7 +403,7 @@ module('Integration | Component | mobile-menu-wrapper', function (hooks) {
await render(hbs`
<MobileMenuWrapper as |mmw|>
<mmw.MobileMenu @isOpen={{this.isOpen}} @onToggle={{this.onToggle}} as |mm|>
<mm.LinkTo @route="index">Home</mm.LinkTo>
<LinkTo @route="index" {{on "click" mm.actions.close}}>Home</LinkTo>
</mmw.MobileMenu>
<mmw.Content>
Expand Down
33 changes: 0 additions & 33 deletions test-app/tests/integration/components/mobile-menu/link-to-test.js

This file was deleted.

0 comments on commit e40b579

Please sign in to comment.