From 2a58f201bd8af680c38ccbb2cf054612628ddf28 Mon Sep 17 00:00:00 2001 From: Adam Kariv Date: Sun, 15 Oct 2023 19:56:34 +0300 Subject: [PATCH] First cta is always primary in card --- .../card-action-nav/card-action-nav.component.less | 2 +- .../app/card-action-nav/card-action-nav.component.ts | 2 +- .../card-action-phone.component.html | 2 +- .../card-action-url/card-action-url.component.less | 2 +- .../app/card-action-url/card-action-url.component.ts | 2 +- .../src/app/quick-actions/quick-actions.component.ts | 11 +++++++---- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/projects/srm/src/app/card-action-nav/card-action-nav.component.less b/projects/srm/src/app/card-action-nav/card-action-nav.component.less index 9f876db7..8dd1df18 100644 --- a/projects/srm/src/app/card-action-nav/card-action-nav.component.less +++ b/projects/srm/src/app/card-action-nav/card-action-nav.component.less @@ -1,5 +1,5 @@ :host { - &:not(.active) { display: none; } + &:not(.visible) { display: none; } app-card-action { width: 100%; } diff --git a/projects/srm/src/app/card-action-nav/card-action-nav.component.ts b/projects/srm/src/app/card-action-nav/card-action-nav.component.ts index 73575b5f..300246e8 100644 --- a/projects/srm/src/app/card-action-nav/card-action-nav.component.ts +++ b/projects/srm/src/app/card-action-nav/card-action-nav.component.ts @@ -6,7 +6,7 @@ import { Card } from '../consts'; templateUrl: './card-action-nav.component.html', styleUrls: ['./card-action-nav.component.less'], host: { - '[class.active]': 'active', + '[class.visible]': 'active', } }) export class CardActionNavComponent implements OnChanges { diff --git a/projects/srm/src/app/card-action-phone/card-action-phone.component.html b/projects/srm/src/app/card-action-phone/card-action-phone.component.html index caa6507e..8a9060ec 100644 --- a/projects/srm/src/app/card-action-phone/card-action-phone.component.html +++ b/projects/srm/src/app/card-action-phone/card-action-phone.component.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/projects/srm/src/app/card-action-url/card-action-url.component.less b/projects/srm/src/app/card-action-url/card-action-url.component.less index 9f876db7..8dd1df18 100644 --- a/projects/srm/src/app/card-action-url/card-action-url.component.less +++ b/projects/srm/src/app/card-action-url/card-action-url.component.less @@ -1,5 +1,5 @@ :host { - &:not(.active) { display: none; } + &:not(.visible) { display: none; } app-card-action { width: 100%; } diff --git a/projects/srm/src/app/card-action-url/card-action-url.component.ts b/projects/srm/src/app/card-action-url/card-action-url.component.ts index 247b2e49..a69adb8d 100644 --- a/projects/srm/src/app/card-action-url/card-action-url.component.ts +++ b/projects/srm/src/app/card-action-url/card-action-url.component.ts @@ -6,7 +6,7 @@ import { Card } from '../consts'; templateUrl: './card-action-url.component.html', styleUrls: ['./card-action-url.component.less'], host: { - '[class.active]': 'active', + '[class.visible]': 'active', } }) export class CardActionUrlComponent implements OnChanges { diff --git a/projects/srm/src/app/quick-actions/quick-actions.component.ts b/projects/srm/src/app/quick-actions/quick-actions.component.ts index 2226856a..e038ccaf 100644 --- a/projects/srm/src/app/quick-actions/quick-actions.component.ts +++ b/projects/srm/src/app/quick-actions/quick-actions.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { AfterViewInit, Component, ElementRef, Input, OnInit } from '@angular/core'; import { Card } from '../consts'; @Component({ @@ -6,13 +6,16 @@ import { Card } from '../consts'; templateUrl: './quick-actions.component.html', styleUrls: ['./quick-actions.component.less'] }) -export class QuickActionsComponent implements OnInit { +export class QuickActionsComponent implements AfterViewInit { @Input() card: Card; - constructor() { } + constructor(private el: ElementRef) { } + + ngAfterViewInit(): void { + const first = this.el.nativeElement.querySelector('.visible app-card-action a') as HTMLElement; + first.classList.add('primary'); - ngOnInit(): void { } }