refactor(web): 提取共享的圆形多选勾选框组件,统一5处重复实现
创建群聊、消息多选、我的收藏多选、黑名单多选、转发选择器——这5个 地方各自手写了一份几乎一样的"圆形+选中变实心+里面check图标"勾选框 markup,样式上有细微且无意的差异(比如有的选中态多画了一圈边框、 用的灰色深浅不完全一致),上次只修了转发选择器一处,用户指出创建 群聊那里同样丑、而且问了"这种组件不该统一做吗"——確实该統一。 新增 `app/SelectionCheckbox.tsx`,把上次在转发选择器里验证过的 矢量勾选图标方案抽成共享组件,5处全部换成调用它。以后这个视觉样式 要再调整,改一个文件就够了,不会再出现"修好了一处,另外四处还是 老样子"的情况。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
3280b92a09
commit
4e1f1cbf0f
@@ -4,6 +4,7 @@ import { useInfiniteQuery, useMutation, useQueryClient } from '@tanstack/react-q
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { Icon } from '@/app/Icon';
|
||||
import { SelectionCheckbox } from '@/app/SelectionCheckbox';
|
||||
import { Toast } from '@/app/Toast';
|
||||
import { AudioAttachment } from '@/features/messages/AttachmentPreview';
|
||||
import { ForwardPickerModal } from '@/features/messages/ForwardPickerModal';
|
||||
@@ -189,15 +190,7 @@ function FavoriteCard({ item, selectMode, selected, onToggle }: { item: Favorite
|
||||
>
|
||||
<div className="relative">
|
||||
{body}
|
||||
{selectMode ? (
|
||||
<span
|
||||
className={`absolute -right-1 -top-1 grid h-5 w-5 place-items-center rounded-full text-[13px] text-white ${
|
||||
selected ? 'bg-accent' : 'border-[1.5px] border-[#c5cad2] bg-white'
|
||||
}`}
|
||||
>
|
||||
{selected ? <Icon name="check" className="text-[14px]" /> : null}
|
||||
</span>
|
||||
) : null}
|
||||
{selectMode ? <SelectionCheckbox selected={selected} className="absolute -right-1 -top-1" /> : null}
|
||||
</div>
|
||||
<div className="flex items-center justify-between border-t border-border-list-item pt-2.5 text-xs text-text-tertiary-3">
|
||||
<SourceLine source={item.source} />
|
||||
|
||||
Reference in New Issue
Block a user