Skip to content

Commit

Permalink
feature: replaced strings with PrimeIcons in examples, interfaces and…
Browse files Browse the repository at this point in the history
… tests
  • Loading branch information
markuczy committed Feb 21, 2024
1 parent 6cecae9 commit 1aef90f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
pButton
*ngIf="dialogData.config.secondaryButtonIncluded"
class="mx-2"
[icon]="dialogData.config.secondaryButtonDetails!.icon !== undefined ? dialogData.config.secondaryButtonDetails!.icon : ''"
icon="{{dialogData.config.secondaryButtonDetails!.icon !== undefined ? dialogData.config.secondaryButtonDetails!.icon : ''}}"
(click)="secondaryButtonAction()"
[label]="dialogData.config.secondaryButtonDetails!.key | translate:dialogData.config.secondaryButtonDetails?.parameters"
[disabled]="secondaryButtonDisabled$ | async"
Expand All @@ -16,7 +16,7 @@
id="buttonDialogPrimaryButton"
pButton
class="mx-2"
[icon]="dialogData.config.primaryButtonDetails!.icon !== undefined ? dialogData.config.primaryButtonDetails!.icon : ''"
icon="{{dialogData.config.primaryButtonDetails!.icon !== undefined ? dialogData.config.primaryButtonDetails!.icon : ''}}"
(click)="primaryButtonAction()"
[label]="dialogData.config.primaryButtonDetails!.key | translate:dialogData.config.primaryButtonDetails?.parameters"
[disabled]="primaryButtonDisabled$ | async"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ButtonDialogComponent } from './button-dialog.component'
import { MockAuthModule } from '../../../mock-auth/mock-auth.module'
import { ButtonDialogHarness, DivHarness } from '../../../../../testing'
import { ButtonDialogConfig } from '../../../model/button-dialog'
import { PrimeIcons } from 'primeng/api'

@Component({
template: `<ocx-button-dialog>
Expand All @@ -20,12 +21,12 @@ class TestBaseHostComponent {}
const config: ButtonDialogConfig = {
primaryButtonDetails: {
key: 'inlineMain',
icon: 'pi pi-plus',
icon: PrimeIcons.PLUS,
},
secondaryButtonIncluded: true,
secondaryButtonDetails: {
key: 'inlineSide',
icon: 'pi pi-times',
icon: PrimeIcons.TIMES,
},
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Type } from '@angular/core'
import { PrimeIcons } from 'primeng/api'

/**
* Object describing details for button rendering containing key for translation, optional icon and optional parameters for translation
Expand All @@ -12,7 +13,7 @@ import { Type } from '@angular/core'
* }
* const buttonDetails: ButtonDialogButtonDetails = {
* key: 'MY_KEY',
* icon: 'pi pi-times',
* icon: PrimeIcons.TIMES,
* parameters: {
* value: 'meeting'
* }
Expand All @@ -21,7 +22,7 @@ import { Type } from '@angular/core'
*/
export interface ButtonDialogButtonDetails {
key: string
icon?: string
icon?: PrimeIcons
parameters?: Record<string, unknown>
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DialogService, DynamicDialogConfig, DynamicDialogRef } from 'primeng/dy
import { ButtonDialogComponent } from '../core/components/button-dialog/button-dialog.component'
import { ButtonDialogButtonDetails, ButtonDialogData } from '../model/button-dialog'
import { DialogMessageContentComponent } from '../core/components/button-dialog/dialog-message-content/dialog-message-content.component'
import { PrimeIcons } from 'primeng/api'

/**
* Object containing key for translation with parameters object for translation
Expand Down Expand Up @@ -57,11 +58,11 @@ type TranslationKey = string | TranslationKeyWithParameters
* value = 'hello',
* },
* },
* icon: 'pi pi-question'
* icon: PrimeIcons.QUESTION
* }
* ```
*/
type DialogMessage = { message: TranslationKey; icon: string }
type DialogMessage = { message: TranslationKey; icon: PrimeIcons }

/**
* Implement via component class to be displayed by {@link PortalDialogService.openDialog}
Expand Down Expand Up @@ -258,7 +259,7 @@ export class PortalDialogService {
* // Welcome message with question mark icon
* const dialogMessage = {
* key: 'WELCOME_MESSAGE',
* icon: 'pi pi-question'
* icon: PrimeIcons.QUESTION
* }
* this.portalDialogService.openDialog('TITLE_KEY', dialogMessage, 'OK_BUTTON').subscribe((stateOnClose) => {
* // operations when dialog has been closed
Expand All @@ -272,13 +273,13 @@ export class PortalDialogService {
* // Ok button with check icon
* const primaryButton = {
* key: 'OK_BUTTON',
* icon: 'pi pi-check'
* icon: PrimeIcons.CHECK
* }
*
* // Refresh button with refresh icon
* const secondaryButton = {
* key: 'REFRESH_BUTTON',
* icon: 'pi pi-refresh'
* icon: PrimeIcons.REFRESH
* }
*
* this.portalDialogService.openDialog('TITLE_KEY', 'WELCOME_MESSAGE', primaryButton, secondaryButton).subscribe((stateOnClose) => {
Expand Down

0 comments on commit 1aef90f

Please sign in to comment.