From 9a78ec0604019d7fe0ac06fc75d0628503aa45a0 Mon Sep 17 00:00:00 2001 From: Wells Date: Wed, 27 Mar 2024 10:26:24 +0800 Subject: [PATCH] fix: render invalid icon in inserted dropdown --- packages/designer/src/simulator/selection.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/designer/src/simulator/selection.tsx b/packages/designer/src/simulator/selection.tsx index 33b73d61..a9146c19 100644 --- a/packages/designer/src/simulator/selection.tsx +++ b/packages/designer/src/simulator/selection.tsx @@ -489,10 +489,19 @@ const insertedItemStyle = css` function InsertedItem({ label, - icon = 'icon-placeholder', + icon, description, ...rest }: HTMLCoralProps<'div'> & Omit) { + let iconNode; + if (!icon) { + iconNode = ; + } else if (icon.startsWith('icon-')) { + iconNode = ; + } else { + iconNode = {label}; + } + return ( - {icon.startsWith('icon-') ? ( - - ) : ( - {label} - )} + {iconNode} {label}