Skip to content

fix: checkbox 选项不渲染 icon#184

Merged
MistEO merged 1 commit intoMistEO:mainfrom
Windsland52:fix/icon
Apr 26, 2026
Merged

fix: checkbox 选项不渲染 icon#184
MistEO merged 1 commit intoMistEO:mainfrom
Windsland52:fix/icon

Conversation

@Windsland52
Copy link
Copy Markdown
Contributor

@Windsland52 Windsland52 commented Apr 20, 2026

Summary by Sourcery

在复选框选项按钮的标签旁渲染图标,同时保留截断和布局约束。

新功能:

  • 当某个选项提供了图标时,在复选框选项标签旁显示可选图标。

增强改进:

  • 调整选项按钮布局,以支持图标和文本在一起显示,并具备正确的截断行为和最小宽度处理。
Original summary in English

Summary by Sourcery

Render icons alongside labels for checkbox option buttons while preserving truncation and layout constraints.

New Features:

  • Display optional icons next to checkbox option labels when an icon is provided for the case item.

Enhancements:

  • Adjust option button layout to support icon and text with proper truncation and minimum width handling.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我发现了 1 个问题

给 AI 代理的提示
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/components/OptionEditor.tsx" line_range="539-543" />
<code_context>
               >
-                {caseLabel}
+                <span className="flex items-center gap-1.5 min-w-0">
+                  {caseItem.icon && (
+                    <AsyncIcon
+                      icon={caseItem.icon}
+                      basePath={basePath}
+                      className="w-4 h-4 object-contain flex-shrink-0"
+                    />
+                  )}
</code_context>
<issue_to_address>
**suggestion:** 考虑将该图标标记为装饰性元素,如果它不传达额外的语义含义。

如果 `caseItem.icon` 只是视觉效果且标签已经足够,请在 `AsyncIcon` 上添加 `aria-hidden`(或类似属性),让屏幕阅读器忽略它。如果图标传达了额外含义,则应确保它具有可访问的名称或描述。
</issue_to_address>

Sourcery 对开源项目免费——如果你喜欢我们的评审,请考虑分享它们 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续评审。
Original comment in English

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/components/OptionEditor.tsx" line_range="539-543" />
<code_context>
               >
-                {caseLabel}
+                <span className="flex items-center gap-1.5 min-w-0">
+                  {caseItem.icon && (
+                    <AsyncIcon
+                      icon={caseItem.icon}
+                      basePath={basePath}
+                      className="w-4 h-4 object-contain flex-shrink-0"
+                    />
+                  )}
</code_context>
<issue_to_address>
**suggestion:** Consider marking the icon as decorative if it doesn’t convey additional semantic meaning.

If `caseItem.icon` is only visual and the label is sufficient, add `aria-hidden` (or similar) to `AsyncIcon` so screen readers ignore it. If the icon conveys extra meaning, instead ensure it has an accessible name/description.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/components/OptionEditor.tsx
Copy link
Copy Markdown
Owner

@MistEO MistEO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 没啥问题

@MistEO MistEO merged commit 2f9fd7c into MistEO:main Apr 26, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants