From 5e8ecec7a3cfab4641f66318635ea0164df6ea63 Mon Sep 17 00:00:00 2001 From: jashan <20891087+jashanbhullar@users.noreply.github.com> Date: Thu, 31 Aug 2023 08:45:48 +0530 Subject: [PATCH] - back to ternary operator --- .../fields/PropertyFields/index.tsx | 71 +++++++++---------- 1 file changed, 33 insertions(+), 38 deletions(-) diff --git a/web/src/beta/components/fields/PropertyFields/index.tsx b/web/src/beta/components/fields/PropertyFields/index.tsx index 33d7122f50..7be829a1c8 100644 --- a/web/src/beta/components/fields/PropertyFields/index.tsx +++ b/web/src/beta/components/fields/PropertyFields/index.tsx @@ -20,44 +20,39 @@ const PropertyFields: React.FC = ({ propertyId, item }) => { const isList = item && "items" in item; const value = !isList ? item.fields.find(f => f.id === sf.id)?.value : sf.defaultValue; - switch (sf.type) { - case "string": - // TODO: Can also be turned into a switch and infact bunch of props are common - return sf.ui === "color" ? ( - - ) : sf.ui === "selection" || sf.choices ? ( -

Selection or choices field

- ) : sf.ui === "buttons" ? ( -

Button radio field

- ) : ( - - ); - case "bool": - return ( - - ); - - default: - return

{sf.name} field

; - } + return sf.type === "string" ? ( + sf.ui === "color" ? ( + + ) : sf.ui === "selection" || sf.choices ? ( +

Selection or choices field

+ ) : sf.ui === "buttons" ? ( +

Button radio field

+ ) : ( + + ) + ) : sf.type == "bool" ? ( + + ) : ( +

{sf.name} field

+ ); })} );