Skip to content

Commit

Permalink
feat: fix styling issues for page header detail values + add ability …
Browse files Browse the repository at this point in the history
…to specify icon styles (#294)

* fix: fix layout + styling issues for page header detail values

* fix: fix broken tests

* feat: add ability to add styleclasses to objectDetail icons
  • Loading branch information
bastianjakobi authored Jun 27, 2024
1 parent 990ef71 commit 08d79c3
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,24 @@ <h2 id="page-subheader" *ngIf="!!subheader">{{ subheader }}</h2>
>
<span
*ngIf="item.icon || item.value"
class="flex text-900 align-items-center gap-2 object-info-grid-value"
[ngClass]="generateItemStyle(item)"
class="object-info-grid-value"
[title]="item.valueTooltip || item.tooltip || ''"
name="object-detail-value"
>
<i *ngIf="item.icon" class="{{item.icon}}" name="object-detail-icon"></i>
{{ item.value | dynamicPipe:item.valuePipe:item.valuePipeArgs}}
<p-button
*ngIf="item.actionItemIcon && item.actionItemCallback"
[icon]="item.actionItemIcon"
styleClass="p-button-text p-0 w-full"
[title]="item.actionItemTooltip || ''"
(onClick)="item.actionItemCallback()"
></p-button>
<span
class="flex text-900 align-items-center gap-2 w-max"
[ngClass]="generateItemStyle(item)"
name="object-detail-value"
>
<i *ngIf="item.icon" class='{{item.icon + " " + (item.iconStyleClass || "")}}' name="object-detail-icon"></i>
{{ item.value | dynamicPipe:item.valuePipe:item.valuePipeArgs}}
<p-button
*ngIf="item.actionItemIcon && item.actionItemCallback"
[icon]="item.actionItemIcon"
styleClass="p-button-text p-0 w-full"
[title]="item.actionItemTooltip || ''"
(onClick)="item.actionItemCallback()"
></p-button>
</span>
</span>
</div>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,26 @@ export const WithObjectDetailsAndIcons = {
},
}

export const WithObjectDetailsAndStyledIcons = {
render: Template,

args: {
header: 'My title',
subheader: 'My subtitle',
loading: false,
objectDetails: [
...demoFields,
{
label: 'Styled Icon',
value: 'Confirmed',
icon: PrimeIcons.CHECK_CIRCLE,
iconStyleClass: 'text-red-400 fadein animation-duration-1000 animation-iteration-infinite'
}
],
showBreadcrumbs: false,
},
}

export const DefaultLayout = {
render: Template,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export interface ObjectDetailItem {
labelTooltip?: string
valueTooltip?: string
icon?: PrimeIcon
iconStyleClass?: string
labelPipe?: Type<any>
valuePipe?: Type<any>
valuePipeArgs?: string
Expand Down

0 comments on commit 08d79c3

Please sign in to comment.