fix(workflow): align block icon vector sizes (#39657)

This commit is contained in:
Jingyi 2026-07-27 16:43:03 -07:00 committed by GitHub
parent f68cabe226
commit b25b28cc76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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<string, string> = {
const ICON_CONTAINER_CLASSNAME_SIZE_MAP: Record<BlockIconSize, string> = {
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<BlockIconSize, string> = {
xs: 'size-3',
sm: 'size-3.5',
md: 'size-4',
}
const DEFAULT_ICON_MAP: Record<BlockEnum, React.ComponentType<{ className: string }>> = {
[BlockEnum.Start]: Home,
@ -144,7 +151,7 @@ const BlockIcon: FC<BlockIconProps> = ({ type, size = 'sm', className, toolIcon
>
<span
aria-hidden
className={cn('i-custom-vender-workflow-user-input', size === 'xs' ? 'size-4' : 'size-4')}
className={cn('i-custom-vender-workflow-user-input', ICON_CLASSNAME_SIZE_MAP[size])}
/>
</div>
)
@ -163,7 +170,7 @@ const BlockIcon: FC<BlockIconProps> = ({ 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],
)}
/>
</div>
@ -180,17 +187,7 @@ const BlockIcon: FC<BlockIconProps> = ({ 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' ? (