Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | 2x 2x 3x 3x 15x | import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
@Component({
selector: 'ish-checkout-progress-bar',
templateUrl: './checkout-progress-bar.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CheckoutProgressBarComponent {
@Input() step = 1;
/**
* Define the checkout steps.
*/
checkoutSteps = [
{
step: 1,
link: '/checkout/address',
labelKey: 'checkout.progress.addresses.label',
stepKey: 'checkout.progress.step1.text',
},
{
step: 2,
link: '/checkout/shipping',
labelKey: 'checkout.progress.shipping.label',
stepKey: 'checkout.progress.step2.text',
},
{
step: 3,
link: '/checkout/payment',
labelKey: 'checkout.progress.payment.label',
stepKey: 'checkout.progress.step3.text',
},
{
step: 4,
link: '/checkout/review',
labelKey: 'checkout.progress.review.label',
stepKey: 'checkout.progress.step4.text',
},
{
step: 5,
link: '/checkout/receipt',
labelKey: 'checkout.progress.receipt.label',
stepKey: 'checkout.progress.step5.text',
},
];
/**
* Checks whether a checkout step should be displayed as link or not.
*
* @param step The checkout step to evaluate.
* @returns Returns 'true' if the step number is lover than the current step and if the current step is lower than 5.
*/
checkoutStepLink(step: number): boolean {
return step < this.step && this.step < 5;
}
}
|