From 2255451745b96cf475f77e3b8e3d98cecba01020 Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Wed, 15 Nov 2023 19:59:58 -0600 Subject: [PATCH] CE-740 Update HeaderIcon to support icon from path (file) instead of name; padding adjustments (put 24/16 on the cards) --- src/qqq/components/widgets/Widget.tsx | 52 ++++++++++++++++----------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/src/qqq/components/widgets/Widget.tsx b/src/qqq/components/widgets/Widget.tsx index eaf786b..9bc0917 100644 --- a/src/qqq/components/widgets/Widget.tsx +++ b/src/qqq/components/widgets/Widget.tsx @@ -102,16 +102,18 @@ export class LabelComponent export class HeaderIcon extends LabelComponent { iconName: string; + iconPath: string; color: string; coloredBG: boolean; iconColor: string; bgColor: string; - constructor(iconName: string, color: string, coloredBG: boolean = true) + constructor(iconName: string, iconPath: string, color: string, coloredBG: boolean = true) { super(); this.iconName = iconName; + this.iconPath = iconPath; this.color = color; this.coloredBG = coloredBG; @@ -122,19 +124,22 @@ export class HeaderIcon extends LabelComponent render = (args: LabelComponentRenderArgs): JSX.Element => { - return ( - {this.iconName} - ) + const styles = { + width: "1.75rem", + height: "1.75rem", + color: this.iconColor, + backgroundColor: this.bgColor, + borderRadius: "0.25rem" + }; + + if(this.iconPath) + { + return () + } + else + { + return ({this.iconName}); + } } } @@ -239,7 +244,7 @@ export class ReloadControl extends LabelComponent render = (args: LabelComponentRenderArgs): JSX.Element => { return ( - + ); @@ -455,7 +460,7 @@ function Widget(props: React.PropsWithChildren): JSX.Element ////////////////////////////////////////////////////////////////////////////////////////// const labelToUse = props.widgetData?.label ?? props.widgetMetaData?.label let labelElement = ( - + {labelToUse} ); @@ -470,8 +475,8 @@ function Widget(props: React.PropsWithChildren): JSX.Element { needLabelBox && - - + + { hasPermission ? props.widgetMetaData?.icon && ( @@ -542,7 +547,12 @@ function Widget(props: React.PropsWithChildren): JSX.Element } { - props.widgetMetaData?.isCard && (reloading ? : ) + /////////////////////////////////////////////////////////////////// + // turning this off... for now. maybe make a property in future // + /////////////////////////////////////////////////////////////////// + /* + props.widgetMetaData?.isCard && (reloading ? : ) + */ } { errorLoading ? ( @@ -552,7 +562,7 @@ function Widget(props: React.PropsWithChildren): JSX.Element ) : ( hasPermission && props.widgetData?.dropdownNeedsSelectedText ? ( - + {props.widgetData?.dropdownNeedsSelectedText} @@ -574,7 +584,7 @@ function Widget(props: React.PropsWithChildren): JSX.Element ; return props.widgetMetaData?.isCard - ? + ? {widgetContent} : {widgetContent};