Merge pull request #5552 from mempool/nymkappa/satoshi-pipe-update

export bitcoinsatoshis pipe module, allow custom class for first part
This commit is contained in:
softsimon 2024-09-28 00:04:56 +04:00 committed by GitHub
commit 775fcbab31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -8,7 +8,7 @@ export class BitcoinsatoshisPipe implements PipeTransform {
constructor(private sanitizer: DomSanitizer) { }
transform(value: string): SafeHtml {
transform(value: string, firstPartClass?: string): SafeHtml {
const newValue = this.insertSpaces(parseFloat(value || '0').toFixed(8));
const position = (newValue || '0').search(/[1-9]/);
@ -16,7 +16,7 @@ export class BitcoinsatoshisPipe implements PipeTransform {
const secondPart = newValue.slice(position);
return this.sanitizer.bypassSecurityTrustHtml(
`<span class="text-secondary">${firstPart}</span>${secondPart}`
`<span class="${firstPartClass ? firstPartClass : 'text-secondary'}">${firstPart}</span>${secondPart}`
);
}

View File

@ -365,6 +365,7 @@ import { OnlyVsizeDirective, OnlyWeightDirective } from './components/weight-dir
TwitterWidgetComponent,
TwitterLogin,
BitcoinInvoiceComponent,
BitcoinsatoshisPipe,
MempoolBlockOverviewComponent,
ClockchainComponent,