Removed unused "active" handling in <GhPostListItem>

no issue

- "active" post list items no longer exist so we can remove the code related to handling the scroll-into-view and style changes
This commit is contained in:
Kevin Ansfield 2019-08-27 10:42:27 +01:00
parent 2500cd9064
commit 9eb9e9f00e
4 changed files with 1 additions and 52 deletions

View File

@ -10,14 +10,8 @@ export default Component.extend({
tagName: 'li',
classNames: ['gh-list-row', 'gh-posts-list-item'],
classNameBindings: ['active'],
post: null,
active: false,
// closure actions
onClick() {},
onDoubleClick() {},
isFeatured: alias('post.featured'),
isPage: alias('post.page'),
@ -47,42 +41,5 @@ export default Component.extend({
} else {
return `${text.slice(0, 80)}...`;
}
}),
didReceiveAttrs() {
if (this.active) {
this.scrollIntoView();
}
},
click() {
this.onClick(this.post);
},
doubleClick() {
this.onDoubleClick(this.post);
},
scrollIntoView() {
let element = this.$();
let offset = element.offset().top;
let elementHeight = element.height();
let container = $('.content-list');
let containerHeight = container.height();
let currentScroll = container.scrollTop();
let isBelowTop, isAboveBottom, isOnScreen;
isAboveBottom = offset < containerHeight;
isBelowTop = offset > elementHeight;
isOnScreen = isBelowTop && isAboveBottom;
if (!isOnScreen) {
// Scroll so that element is centered in container
// 40 is the amount of padding on the container
container.clearQueue().animate({
scrollTop: currentScroll + offset - 40 - containerHeight / 2
});
}
}
})
});

View File

@ -359,12 +359,6 @@
}
}
@media (min-width: 901px) {
.content-list .active a {
box-shadow: var(--blue) 3px 0 0 inset;
}
}
/* Empty State
/* ---------------------------------------------------------- */

View File

@ -96,7 +96,6 @@
{{#each postsInfinityModel as |page|}}
{{gh-posts-list-item
post=page
onDoubleClick=(action "openEditor")
data-test-page-id=page.id}}
{{else}}
<li class="no-posts-box">

View File

@ -96,7 +96,6 @@
{{#each postsInfinityModel as |post|}}
{{gh-posts-list-item
post=post
onDoubleClick=(action "openEditor")
data-test-post-id=post.id}}
{{else}}
<li class="no-posts-box">