mempool/frontend/src/app/shared/components/truncate/truncate.component.ts

27 lines
782 B
TypeScript
Raw Normal View History

2023-01-17 03:22:18 +04:00
import { Component, Input, Inject, LOCALE_ID, ChangeDetectionStrategy } from '@angular/core';
2023-01-05 11:00:08 -06:00
@Component({
selector: 'app-truncate',
templateUrl: './truncate.component.html',
2023-01-17 03:22:18 +04:00
styleUrls: ['./truncate.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
2023-01-05 11:00:08 -06:00
})
export class TruncateComponent {
@Input() text: string;
@Input() link: any = null;
2024-02-16 02:30:51 +00:00
@Input() external: boolean = false;
2023-01-05 11:00:08 -06:00
@Input() lastChars: number = 4;
@Input() maxWidth: number = null;
2023-07-09 01:15:05 -04:00
@Input() inline: boolean = false;
@Input() textAlign: 'start' | 'end' = 'start';
2023-01-05 11:00:08 -06:00
rtl: boolean;
constructor(
@Inject(LOCALE_ID) private locale: string,
) {
if (this.locale.startsWith('ar') || this.locale.startsWith('fa') || this.locale.startsWith('he')) {
this.rtl = true;
}
}
}