From b25b28cc76390b7958dd18fbf5b9dcd50afb9eb5 Mon Sep 17 00:00:00 2001 From: Jingyi Date: Mon, 27 Jul 2026 16:43:03 -0700 Subject: [PATCH] fix(workflow): align block icon vector sizes (#39657) --- web/app/components/workflow/block-icon.tsx | 27 ++++++++++------------ 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/web/app/components/workflow/block-icon.tsx b/web/app/components/workflow/block-icon.tsx index 2a890ff47fc..eb59485c328 100644 --- a/web/app/components/workflow/block-icon.tsx +++ b/web/app/components/workflow/block-icon.tsx @@ -31,17 +31,24 @@ import { import { API_PREFIX } from '@/config' import { BlockEnum } from './types' +type BlockIconSize = 'xs' | 'sm' | 'md' + type BlockIconProps = { type: BlockEnum - size?: string + size?: BlockIconSize className?: string toolIcon?: string | { content: string; background: string } } -const ICON_CONTAINER_CLASSNAME_SIZE_MAP: Record = { +const ICON_CONTAINER_CLASSNAME_SIZE_MAP: Record = { xs: 'w-4 h-4 rounded-[5px] shadow-xs', sm: 'w-5 h-5 rounded-md shadow-xs', md: 'w-6 h-6 rounded-lg shadow-md', } +const ICON_CLASSNAME_SIZE_MAP: Record = { + xs: 'size-3', + sm: 'size-3.5', + md: 'size-4', +} const DEFAULT_ICON_MAP: Record> = { [BlockEnum.Start]: Home, @@ -144,7 +151,7 @@ const BlockIcon: FC = ({ type, size = 'sm', className, toolIcon > ) @@ -163,7 +170,7 @@ const BlockIcon: FC = ({ type, size = 'sm', className, toolIcon aria-hidden className={cn( 'i-custom-vender-workflow-start-placeholder text-text-primary opacity-30', - size === 'xs' ? 'size-3' : 'size-3.5', + ICON_CLASSNAME_SIZE_MAP[size], )} /> @@ -180,17 +187,7 @@ const BlockIcon: FC = ({ type, size = 'sm', className, toolIcon className, )} > - {showDefaultIcon && - getIcon( - type, - type === BlockEnum.TriggerSchedule || type === BlockEnum.TriggerWebhook - ? size === 'xs' - ? 'w-4 h-4' - : 'w-4.5 h-4.5' - : size === 'xs' - ? 'w-3 h-3' - : 'w-3.5 h-3.5', - )} + {showDefaultIcon && getIcon(type, ICON_CLASSNAME_SIZE_MAP[size])} {!showDefaultIcon && ( <> {typeof resolvedToolIcon === 'string' ? (