mirror of
https://github.com/mempool/mempool.git
synced 2025-03-15 12:20:28 +01:00
export bitcoinsatoshis pipe module, allow custom class for first part
This commit is contained in:
parent
676abf58fd
commit
2d7316942f
2 changed files with 3 additions and 2 deletions
|
@ -8,7 +8,7 @@ export class BitcoinsatoshisPipe implements PipeTransform {
|
||||||
|
|
||||||
constructor(private sanitizer: DomSanitizer) { }
|
constructor(private sanitizer: DomSanitizer) { }
|
||||||
|
|
||||||
transform(value: string): SafeHtml {
|
transform(value: string, firstPartClass?: string): SafeHtml {
|
||||||
const newValue = this.insertSpaces(parseFloat(value || '0').toFixed(8));
|
const newValue = this.insertSpaces(parseFloat(value || '0').toFixed(8));
|
||||||
const position = (newValue || '0').search(/[1-9]/);
|
const position = (newValue || '0').search(/[1-9]/);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ export class BitcoinsatoshisPipe implements PipeTransform {
|
||||||
const secondPart = newValue.slice(position);
|
const secondPart = newValue.slice(position);
|
||||||
|
|
||||||
return this.sanitizer.bypassSecurityTrustHtml(
|
return this.sanitizer.bypassSecurityTrustHtml(
|
||||||
`<span class="text-secondary">${firstPart}</span>${secondPart}`
|
`<span class="${firstPartClass ? firstPartClass : 'text-secondary'}">${firstPart}</span>${secondPart}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -365,6 +365,7 @@ import { OnlyVsizeDirective, OnlyWeightDirective } from './components/weight-dir
|
||||||
TwitterWidgetComponent,
|
TwitterWidgetComponent,
|
||||||
TwitterLogin,
|
TwitterLogin,
|
||||||
BitcoinInvoiceComponent,
|
BitcoinInvoiceComponent,
|
||||||
|
BitcoinsatoshisPipe,
|
||||||
|
|
||||||
MempoolBlockOverviewComponent,
|
MempoolBlockOverviewComponent,
|
||||||
ClockchainComponent,
|
ClockchainComponent,
|
||||||
|
|
Loading…
Add table
Reference in a new issue