mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 20:43:41 +00:00
Refactor i18n approach (#2875)
* Refactor i18n approach * chore: move to shared * chore: add default * create DialogService and update LoadingService (#2876) * complete translation infra for ui project, currently broken * cleanup and more dictionaries * chore: fix --------- Co-authored-by: Matt Hill <MattDHill@users.noreply.github.com> Co-authored-by: Matt Hill <mattnine@protonmail.com>
This commit is contained in:
41
web/projects/shared/src/components/ticker.component.ts
Normal file
41
web/projects/shared/src/components/ticker.component.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
ElementRef,
|
||||
HostBinding,
|
||||
HostListener,
|
||||
} from '@angular/core'
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
selector: '[ticker]',
|
||||
template: '<ng-content />',
|
||||
styles: `
|
||||
:host {
|
||||
max-width: 100%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
transition: text-indent 1s;
|
||||
|
||||
&:hover {
|
||||
text-indent: var(--indent, 0);
|
||||
text-overflow: clip;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
`,
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user