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

fix for ember 4 #229

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions addon/components/mobile-menu/link-to.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<LinkTo
@route={{@route}}
@disabled={{@disabled}}
@current-when={{@current-when}}
@models={{this.models}}
@query={{this.query}}
{{on "click" this.click}}
...attributes
>
{{yield}}
</LinkTo>
38 changes: 19 additions & 19 deletions addon/components/mobile-menu/link-to.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
/* eslint-disable ember/no-classic-classes, ember/no-component-lifecycle-hooks */
import { LinkComponent } from '@ember/legacy-built-in-components';
import Component from '@glimmer/component';
import { action } from '@ember/object';

/**
* An extended LinkTo component which provides an onClick hook.
*
* @class LinkTo
* @public
*/
export default LinkComponent.extend({
didReceiveAttrs() {
this._super(...arguments);
export default class LinkToComponent extends Component {
get models() {
if (this.args.models) {
return this.args.models;
}
if (this.args.model) {
return [this.args.model];
}
return [];
}

this.set('current-when', this.qualifiedRouteName);
},

/**
* Hook called when the link is clicked.
*
* @argument onClick
* @type function
* @default function(){}
*/
onClick() {},
get query() {
return this.args.query || {};
}

@action
click() {
this.onClick();
},
});
this.args?.onClick();
}
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"prepare": "node ./compile-css.js"
},
"dependencies": {
"@ember/legacy-built-in-components": "^0.4.0",
"@ember/render-modifiers": "^2.0.0",
"@glimmer/component": "^1.0.4",
"@glimmer/tracking": "^1.0.4",
Expand Down