fix: 笔记列表 hover 操作按钮与日期互换显示

This commit is contained in:
MikiVL 2026-05-05 03:45:05 +08:00
parent 8ce1072b0c
commit 2ade39d58f

View File

@ -582,32 +582,34 @@ function DraggableNoteItem({ note, active, editing, editValue, editRef, activeTa
</span>
)}
</div>
{hovered ? (
<div className="flex items-center gap-0.5 shrink-0">
<button
className="toolbar-btn"
style={{ width: 20, height: 20, color: note.starred ? '#f59e0b' : 'var(--text-faint)' }}
title={note.starred ? '取消收藏' : '收藏'}
onClick={(e) => { e.stopPropagation(); onToggleStar() }}
>
<Star size={12} fill={note.starred ? '#f59e0b' : 'none'} />
</button>
<button
className="toolbar-btn"
style={{ width: 20, height: 20, color: '#ef4444', opacity: 0.8 }}
title="删除笔记"
onClick={(e) => { e.stopPropagation(); onDelete() }}
onMouseEnter={e => (e.currentTarget.style.opacity = '1')}
onMouseLeave={e => (e.currentTarget.style.opacity = '0.8')}
>
<Trash2 size={12} />
</button>
</div>
) : (
<span className="text-xs shrink-0 mt-0.5" style={{ color: 'var(--text-faint)' }}>
{formatDate(note.updatedAt)}
</span>
)}
<div className="flex items-center gap-0.5 shrink-0">
{hovered ? (
<>
<button
className="toolbar-btn"
style={{ width: 20, height: 20, color: note.starred ? '#f59e0b' : 'var(--text-faint)' }}
title={note.starred ? '取消收藏' : '收藏'}
onClick={(e) => { e.stopPropagation(); onToggleStar() }}
>
<Star size={12} fill={note.starred ? '#f59e0b' : 'none'} />
</button>
<button
className="toolbar-btn"
style={{ width: 20, height: 20, color: '#ef4444', opacity: 0.8 }}
title="删除笔记"
onClick={(e) => { e.stopPropagation(); onDelete() }}
onMouseEnter={e => (e.currentTarget.style.opacity = '1')}
onMouseLeave={e => (e.currentTarget.style.opacity = '0.8')}
>
<Trash2 size={12} />
</button>
</>
) : (
<span className="text-xs" style={{ color: 'var(--text-faint)' }}>
{formatDate(note.updatedAt)}
</span>
)}
</div>
</div>
{note.tags.length > 0 && (
<div className="flex gap-1 mt-1 flex-wrap">