Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: PrimeIcons usage for icons in dialog service #138

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 : ''}}"
markuczy marked this conversation as resolved.
Show resolved Hide resolved
(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
Loading