Pārlūkot izejas kodu

refactor code base on comments

namnguyen 11 mēneši atpakaļ
vecāks
revīzija
cdc08342ef

+ 3 - 4
frontend/taipy-gui/src/components/Taipy/Metric.tsx

@@ -58,7 +58,6 @@ const Metric = (props: MetricProps) => {
     const delta = useDynamicProperty(props.delta, props.defaultDelta, undefined)
     const className = useClassNames(props.libClassName, props.dynamicClassName, props.className);
     const baseLayout = useDynamicJsonProperty(props.layout, props.defaultLayout || "", emptyLayout);
-    const baseStyle = useDynamicJsonProperty(props.style, props.defaultStyle || "", defaultStyle);
     const hover = useDynamicProperty(props.hoverText, props.defaultHoverText, undefined);
 
     const data = useMemo(() => {
@@ -110,9 +109,9 @@ const Metric = (props: MetricProps) => {
     const style = useMemo(
         () =>
             height === undefined
-                ? ({...baseStyle, width: width} as CSSProperties)
-                : ({...baseStyle, width: width, height: height} as CSSProperties),
-        [baseStyle, height, width]
+                ? ({...defaultStyle, width: width} as CSSProperties)
+                : ({...defaultStyle, width: width, height: height} as CSSProperties),
+        [height, width]
     );
 
     const skelStyle = useMemo(() => ({...style, minHeight: "7em"}), [style]);

+ 0 - 1
taipy/gui/_renderers/factory.py

@@ -362,7 +362,6 @@ class _Factory:
                 ("id",),
                 ("active", PropertyType.dynamic_boolean, True),
                 ("layout", PropertyType.dynamic_dict),
-                ("style", PropertyType.dynamic_dict),
                 ("type", PropertyType.string, "circular"),
                 ("min", PropertyType.number, 0),
                 ("max", PropertyType.number, 100),