Merge in TEA/mina-sidor-fa-web from feature/TV-954-CIAM-self-service-link to develop Squashed commit of the following: commit 86ce019f1cbe2b78fec6f07ce28318004daf3b3f Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Mon Dec 6 14:41:51 2021 +0100 Added link to CIAM self-service
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
|
import { Params } from '@angular/router';
|
|
import { UiLinkButtonType } from './link-button-type.enum';
|
|
|
|
@Component({
|
|
selector: 'ui-link-button',
|
|
templateUrl: './link-button.component.html',
|
|
styleUrls: ['./link-button.component.scss'],
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
})
|
|
export class LinkButtonComponent {
|
|
@Input() uiType: UiLinkButtonType = UiLinkButtonType.PRIMARY;
|
|
@Input() uiSize: 's' | 'm' | 'l' = 'm';
|
|
@Input() uiFullWidth = false;
|
|
@Input() uiRouterLink: string | string[];
|
|
@Input() uiHref: string;
|
|
@Input() uiTarget: '_blank' | '_self' | '_parent' | '_top' | string = '_self';
|
|
@Input() uiQueryParams: Params = null;
|
|
|
|
roundedButtonTypes: UiLinkButtonType[] = [
|
|
UiLinkButtonType.ROUNDED_PRIMARY,
|
|
UiLinkButtonType.ROUNDED_PRIMARY_ALT,
|
|
UiLinkButtonType.ROUNDED_SECONDARY,
|
|
UiLinkButtonType.ROUNDED_SECONDARY_ALT,
|
|
];
|
|
|
|
get linkButtonClass(): string {
|
|
const defaultClass = this.isRoundedButtonType ? 'ui-link-rounded-button' : 'ui-link-button';
|
|
let currentClass = `${defaultClass} ${defaultClass}--${this.uiSize} ${defaultClass}--${this.uiType}`;
|
|
|
|
if (this.uiFullWidth) {
|
|
currentClass = `${currentClass} ${defaultClass}--full-width`;
|
|
}
|
|
|
|
return currentClass;
|
|
}
|
|
|
|
get isRoundedButtonType(): boolean {
|
|
return this.roundedButtonTypes.includes(this.uiType);
|
|
}
|
|
}
|