Skip to content

Commit

Permalink
1705 Added prop for custom icon summary card (#1759)
Browse files Browse the repository at this point in the history
* 1705 Added prop for custom icon summary card

* Resolve comments
  • Loading branch information
Georgi2704 authored Mar 3, 2025
1 parent 1093cb7 commit 56bdc1d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/sharp-foxes-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@orchestrator-ui/orchestrator-ui-components': patch
---

1705 Added prop for custom icon summary card
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ export enum SummaryCardStatus {
export type WfoSummaryCardProps = {
headerTitle: string;
headerValue: string | number;
headerStatus: SummaryCardStatus;
listTitle: string;
listItems: SummaryCardListItem[];
headerStatus?: SummaryCardStatus;
button?: SummaryCardButtonConfig;
isLoading?: boolean;
headerBadge?: Pick<WfoSummaryCardHeaderProps, 'iconType' | 'iconColor'>;
};

export const WfoSummaryCard: FC<WfoSummaryCardProps> = ({
Expand All @@ -36,14 +37,15 @@ export const WfoSummaryCard: FC<WfoSummaryCardProps> = ({
headerTitle,
listTitle,
listItems,
headerBadge,
}) => {
const { theme } = useOrchestratorTheme();
const { cardContainerStyle } = useWithOrchestratorTheme(
getWfoSummaryCardsStyles,
);

const getIconTypeAndColorForHeaderStatus = (
status: SummaryCardStatus,
status?: SummaryCardStatus,
): Pick<WfoSummaryCardHeaderProps, 'iconType' | 'iconColor'> => {
switch (status) {
case SummaryCardStatus.Success:
Expand All @@ -57,11 +59,17 @@ export const WfoSummaryCard: FC<WfoSummaryCardProps> = ({
iconColor: theme.colors.danger,
};
case SummaryCardStatus.Neutral:
default:
return {
iconType: 'kubernetesPod',
iconColor: theme.colors.primary,
};
default:
return (
headerBadge ?? {
iconType: 'kubernetesPod',
iconColor: theme.colors.primary,
}
);
}
};

Expand Down

0 comments on commit 56bdc1d

Please sign in to comment.