Ghost/ghost/admin/app/components/member/activity-feed.js
James Morris fe46bd05fb Added in email clicks icon and better handling of URLs
- Now has a new email click icon
- Handles long URLs better in the events list
- Fixed narrow viewports bug with events

refs https://github.com/TryGhost/Team/issues/1936
2022-09-21 14:05:37 +01:00

32 lines
1.1 KiB
JavaScript

import Component from '@glimmer/component';
import {action} from '@ember/object';
export default class ActivityFeed extends Component {
linkScrollerTimeout = null; // needs to be global so can be cleared when needed across functions
@action
enterLinkURL(event) {
event.stopPropagation();
const parent = event.target;
const child = event.target.querySelector('span');
clearTimeout(this.linkScrollerTimeout);
if (child.offsetWidth > parent.offsetWidth) {
this.linkScrollerTimeout = setTimeout(() => {
parent.classList.add('scroller');
child.style.transform = `translateX(-${(child.offsetWidth - parent.offsetWidth) + 8}px)`;
}, 100);
}
}
@action
leaveLinkURL(event) {
event.stopPropagation();
clearTimeout(this.linkScrollerTimeout);
const parent = event.target;
const child = event.target.querySelector('span');
child.style.transform = 'translateX(0)';
parent.classList.remove('scroller');
}
}