feat(shared): Ticker add new component and use it in marketplace (#1940)

This commit is contained in:
Alex Inkin
2022-11-11 22:08:13 +03:00
committed by Aiden McClelland
parent a29cd622c3
commit 9ed2e2b0ca
8 changed files with 69 additions and 4 deletions

View File

@@ -0,0 +1,11 @@
:host {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
transition: text-indent 1s;
&:hover {
text-indent: var(--indent, 0);
text-overflow: clip;
}
}

View File

@@ -0,0 +1,27 @@
import {
ChangeDetectionStrategy,
Component,
ElementRef,
HostBinding,
HostListener,
} from '@angular/core'
@Component({
selector: '[ticker]',
template: '<ng-content></ng-content>',
styleUrls: ['./ticker.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TickerComponent {
constructor(private readonly elementRef: ElementRef<HTMLElement>) {}
@HostBinding('style.--indent.px')
indent = 0
@HostListener('mouseenter')
onMouseEnter() {
const { scrollWidth, clientWidth } = this.elementRef.nativeElement
this.indent = Math.ceil(clientWidth - scrollWidth)
}
}

View File

@@ -0,0 +1,9 @@
import { NgModule } from '@angular/core'
import { TickerComponent } from './ticker.component'
@NgModule({
declarations: [TickerComponent],
exports: [TickerComponent],
})
export class TickerModule {}

View File

@@ -13,6 +13,8 @@ export * from './components/markdown/markdown.component'
export * from './components/markdown/markdown.component.module'
export * from './components/text-spinner/text-spinner.component'
export * from './components/text-spinner/text-spinner.component.module'
export * from './components/ticker/ticker.component'
export * from './components/ticker/ticker.module'
export * from './components/toast/toast.component'
export * from './components/toast/toast.module'
export * from './components/toast/toast-button.directive'