Skip to content

Commit 7555bfa

Browse files
committed
style: add colored icons to note cards with consistent spacing
1 parent 1c8acec commit 7555bfa

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

src/components/notes/NotesPanel/NoteCard.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { memo, useMemo } from 'react';
2-
import { Star, Paperclip } from 'lucide-react';
2+
import { Star, Paperclip, Codesandbox } from 'lucide-react';
33
import type { Note, Folder as FolderType } from '@/types/note.ts';
44

55
interface NoteCardProps {
@@ -90,6 +90,15 @@ function NoteCard({
9090
return folders.find((f) => f.id === note.folderId) || null;
9191
}, [note?.folder, note?.folderId, folders]);
9292

93+
const hasExecutableCode = useMemo(() => {
94+
if (!note?.content) return false;
95+
96+
// Check for executable code block markers
97+
return note.content.includes('data-executable="true"') ||
98+
note.content.includes('class="executable-code-block"') ||
99+
note.content.includes('executableCodeBlock');
100+
}, [note?.content]);
101+
93102
if (!note) {
94103
return null;
95104
}
@@ -105,7 +114,7 @@ function NoteCard({
105114
<div className="bg-primary absolute top-0 bottom-0 left-0 w-0.5" />
106115
)}
107116

108-
<div className="p-4 pl-5">
117+
<div className="p-2.5 pl-3.5">
109118
<div className="mb-1 flex items-start justify-between">
110119
<h3
111120
className={`pr-2 text-sm leading-5 font-medium ${
@@ -115,9 +124,14 @@ function NoteCard({
115124
{note.title || 'Untitled'}
116125
</h3>
117126
<div className="flex items-center gap-1">
127+
{hasExecutableCode && (
128+
<div className="flex items-center text-xs" title="Contains executable code">
129+
<Codesandbox className="h-3.5 w-3.5 text-purple-500" />
130+
</div>
131+
)}
118132
{note.attachments && note.attachments.length > 0 && (
119-
<div className="text-muted-foreground flex items-center gap-0.5 text-xs">
120-
<Paperclip className="h-3 w-3" />
133+
<div className="flex items-center gap-1 text-xs text-blue-500">
134+
<Paperclip className="h-3.5 w-3.5" />
121135
<span>{note.attachments.length}</span>
122136
</div>
123137
)}
@@ -126,7 +140,7 @@ function NoteCard({
126140
e.stopPropagation();
127141
onToggleStar(note.id);
128142
}}
129-
className="hover:bg-muted shrink-0 rounded p-1"
143+
className="hover:bg-muted shrink-0 rounded"
130144
>
131145
<Star
132146
className={`h-3.5 w-3.5 ${

0 commit comments

Comments
 (0)