Converted <GhPostsListItem> to glimmer component

no issue

- moved tag name and classes into template
- updated backing class to native class syntax
This commit is contained in:
Kevin Ansfield 2020-07-01 18:39:03 +01:00
parent 1f87c59055
commit ec925a60b0
2 changed files with 65 additions and 69 deletions

View File

@ -1,3 +1,4 @@
<li class="gh-list-row gh-posts-list-item" ...attributes>
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data gh-post-list-featured" @title="Edit this post">
{{#if @post.isFeatured}}
<span data-tooltip="Featured" class="dib pl1 pr1 nr1 nl1">{{svg-jar "star-filled" class="fill-blue w3 h3"}}</span>
@ -68,3 +69,4 @@
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data gh-post-list-updated" @title="Edit this post">
<span class="nowrap">{{gh-format-post-time @post.updatedAtUTC draft=true}}</span>
</LinkTo>
</li>

View File

@ -1,16 +1,10 @@
import Component from '@ember/component';
import {computed} from '@ember/object';
import Component from '@glimmer/component';
import {inject as service} from '@ember/service';
export default Component.extend({
session: service(),
export default class GhPostsListItemComponent extends Component {
@service session;
tagName: 'li',
classNames: ['gh-list-row', 'gh-posts-list-item'],
authorNames: computed('post.authors.[]', function () {
let authors = this.get('post.authors');
return authors.map(author => author.get('name') || author.get('email')).join(', ');
})
});
get authorNames() {
return this.args.post.authors.map(author => author.name || author.email).join(', ');
}
}