Skip to content

Commit 0199508

Browse files
fix(custom-blocks): stop image icons blowing up on class-sized surfaces (#5878)
1 parent 4856ef3 commit 0199508

16 files changed

Lines changed: 32 additions & 35 deletions

File tree

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/menus/suggestion-menu-chrome.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ export const SUGGESTION_SURFACE_CLASS =
1414
*/
1515
export const SUGGESTION_SCROLL_CLASS = 'max-h-[240px] scroll-py-1.5 overflow-y-auto overscroll-none'
1616

17-
/** A selectable row: icon + label, 14px icon in `--text-icon`, truncating label. */
17+
/** A selectable row: icon + label, 14px icon in `--text-icon`, truncating label. The `img` rules
18+
* size custom-block image icons (rendered as `<img>`, so the `svg` rules never reach them). */
1819
export const SUGGESTION_ITEM_CLASS =
19-
'relative flex w-full min-w-0 cursor-pointer select-none items-center gap-2 rounded-[5px] px-2 py-1.5 text-left font-medium text-[var(--text-body)] text-caption outline-none transition-colors [&>span]:min-w-0 [&>span]:truncate [&_svg]:pointer-events-none [&_svg]:size-[14px] [&_svg]:shrink-0 [&_svg]:text-[var(--text-icon)]'
20+
'relative flex w-full min-w-0 cursor-pointer select-none items-center gap-2 rounded-[5px] px-2 py-1.5 text-left font-medium text-[var(--text-body)] text-caption outline-none transition-colors [&>span]:min-w-0 [&>span]:truncate [&_svg]:pointer-events-none [&_svg]:size-[14px] [&_svg]:shrink-0 [&_svg]:text-[var(--text-icon)] [&_img]:pointer-events-none [&_img]:size-[14px] [&_img]:shrink-0'
2021

2122
/** A group heading above a run of rows. */
2223
export const SUGGESTION_GROUP_LABEL_CLASS =

apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/agent-group/tool-call-item.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,7 @@ export function ToolCallItem({
107107
return (
108108
<div className='flex items-center gap-[6px] pl-6'>
109109
{BlockIcon && (
110-
// Size via inline style: a custom block's image icon carries a trailing
111-
// `size-full` that defeats size *classes* (it fills tiled surfaces), so a
112-
// class-only size renders the uploaded icon at natural size here.
113-
<BlockIcon
114-
className='size-[14px] flex-shrink-0'
115-
style={{ width: 14, height: 14, ...getBareIconStyle(BlockIcon) }}
116-
/>
110+
<BlockIcon className='size-[14px] flex-shrink-0' style={getBareIconStyle(BlockIcon)} />
117111
)}
118112
{isExecuting ? (
119113
<ShimmerText className='text-[13px] [--shimmer-rest:var(--text-secondary)]'>

apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/trace-view/trace-view.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ const TraceTreeRow = memo(function TraceTreeRow({
332332
)}
333333
{!isIterationType(span.type) && (
334334
<div
335-
className='flex size-[14px] flex-shrink-0 items-center justify-center overflow-hidden rounded-sm'
335+
className='flex size-[14px] flex-shrink-0 items-center justify-center overflow-hidden rounded-sm [&_img]:size-full'
336336
style={{ background: bgColor }}
337337
>
338338
{BlockIcon && <BlockIcon className={cn('size-[10px]', iconColorClass(bgColor))} />}
@@ -707,7 +707,7 @@ const TraceDetailPane = memo(function TraceDetailPane({ span }: { span: TraceSpa
707707
<div className='flex items-start gap-2'>
708708
{!isIterationType(span.type) && (
709709
<div
710-
className='mt-[2px] flex size-[18px] flex-shrink-0 items-center justify-center rounded-sm'
710+
className='mt-[2px] flex size-[18px] flex-shrink-0 items-center justify-center overflow-hidden rounded-sm [&_img]:size-full'
711711
style={{ background: bgColor }}
712712
>
713713
{BlockIcon && <BlockIcon className={cn('size-[12px]', iconColorClass(bgColor))} />}

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/workflow-sidebar/workflow-sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ const TagIcon: React.FC<{
178178
color: string
179179
}> = ({ icon, color }) => (
180180
<div
181-
className='flex size-[14px] flex-shrink-0 items-center justify-center rounded'
181+
className='flex size-[14px] flex-shrink-0 items-center justify-center overflow-hidden rounded [&_img]:size-full'
182182
style={{ background: color }}
183183
>
184184
{typeof icon === 'string' ? (

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const TagIcon: React.FC<{
2828
color: string
2929
}> = ({ icon, color }) => (
3030
<div
31-
className='flex size-[14px] flex-shrink-0 items-center justify-center rounded'
31+
className='flex size-[14px] flex-shrink-0 items-center justify-center overflow-hidden rounded [&_img]:size-full'
3232
style={{ background: color }}
3333
>
3434
{typeof icon === 'string' ? (

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/connection-blocks/connection-blocks.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function ConnectionItem({
145145
}}
146146
>
147147
<div
148-
className='relative flex size-[14px] flex-shrink-0 items-center justify-center overflow-hidden rounded-sm'
148+
className='[&_img]:!size-full relative flex size-[14px] flex-shrink-0 items-center justify-center overflow-hidden rounded-sm'
149149
style={{ background: bgColor }}
150150
>
151151
{Icon && (
@@ -154,7 +154,7 @@ function ConnectionItem({
154154
'transition-transform duration-200',
155155
getTileIconColorClass(bgColor),
156156
hasFields && 'group-hover:scale-110',
157-
'!h-[9px] !w-[9px]'
157+
'!size-[9px]'
158158
)}
159159
/>
160160
)}

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ const TagIcon: React.FC<{
387387
color: string
388388
}> = ({ icon, color }) => (
389389
<div
390-
className='flex size-[14px] flex-shrink-0 items-center justify-center rounded'
390+
className='flex size-[14px] flex-shrink-0 items-center justify-center overflow-hidden rounded [&_img]:size-full'
391391
style={{ background: color }}
392392
>
393393
{typeof icon === 'string' ? (

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ function createToolIcon(
408408
) {
409409
return (
410410
<div
411-
className='flex size-[16px] flex-shrink-0 items-center justify-center rounded-sm'
411+
className='flex size-[16px] flex-shrink-0 items-center justify-center overflow-hidden rounded-sm [&_img]:size-full'
412412
style={{ background: bgColor }}
413413
>
414414
<IconComponent className={cn('size-[10px]', getTileIconColorClass(bgColor))} />

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/editor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ export function Editor() {
373373
<div className='flex min-w-0 flex-1 items-center gap-2'>
374374
{(blockConfig || isSubflow) && currentBlock?.type !== 'note' && (
375375
<div
376-
className='flex size-[18px] items-center justify-center rounded-sm'
376+
className='flex size-[18px] items-center justify-center overflow-hidden rounded-sm [&_img]:size-full'
377377
style={{ background: isSubflow ? subflowConfig?.bgColor : blockConfig?.bgColor }}
378378
>
379379
<IconComponent

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/toolbar/toolbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const ToolbarItem = memo(function ToolbarItem({
130130
onKeyDown={handleKeyDown}
131131
>
132132
<div
133-
className='relative flex size-[16px] flex-shrink-0 items-center justify-center overflow-hidden rounded-sm'
133+
className='relative flex size-[16px] flex-shrink-0 items-center justify-center overflow-hidden rounded-sm [&_img]:size-full'
134134
style={{ background: item.bgColor }}
135135
>
136136
{Icon && (

0 commit comments

Comments
 (0)