Files
mina-sidor-fa-web/libs/ui/src/link-button/link-button.component.ts
Erik Tiekstra 551f9e2f91 feat(mitt-konto): Added link to CIAM self-service to support edit functionality. (TV-954)
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
2021-12-07 09:44:58 +01:00

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);
}
}