chore(react/collections/list): add class to title

This commit is contained in:
Elian Doran 2025-08-30 17:00:24 +03:00
parent c13f5a9b04
commit a9c5a3105f
No known key found for this signature in database
3 changed files with 7 additions and 3 deletions

View File

@ -54,7 +54,7 @@ function NoteCard({ note, expand }: { note: FNote, expand?: boolean }) {
/> />
<Icon className="note-icon" icon={note.getIcon()} /> <Icon className="note-icon" icon={note.getIcon()} />
<NoteLink notePath={notePath} noPreview showNotePath={isSearch} /> <NoteLink className="note-book-title" notePath={notePath} noPreview showNotePath={isSearch} />
{isExpanded && <> {isExpanded && <>
<NoteContent note={note} /> <NoteContent note={note} />
<NoteChildren note={note} /> <NoteChildren note={note} />

View File

@ -3,6 +3,7 @@ import link from "../../services/link";
import RawHtml from "./RawHtml"; import RawHtml from "./RawHtml";
interface NoteLinkOpts { interface NoteLinkOpts {
className?: string;
notePath: string | string[]; notePath: string | string[];
showNotePath?: boolean; showNotePath?: boolean;
showNoteIcon?: boolean; showNoteIcon?: boolean;
@ -11,7 +12,7 @@ interface NoteLinkOpts {
noTnLink?: boolean; noTnLink?: boolean;
} }
export default function NoteLink({ notePath, showNotePath, showNoteIcon, style, noPreview, noTnLink }: NoteLinkOpts) { export default function NoteLink({ className, notePath, showNotePath, showNoteIcon, style, noPreview, noTnLink }: NoteLinkOpts) {
const stringifiedNotePath = Array.isArray(notePath) ? notePath.join("/") : notePath; const stringifiedNotePath = Array.isArray(notePath) ? notePath.join("/") : notePath;
const [ jqueryEl, setJqueryEl ] = useState<JQuery<HTMLElement>>(); const [ jqueryEl, setJqueryEl ] = useState<JQuery<HTMLElement>>();
@ -33,6 +34,10 @@ export default function NoteLink({ notePath, showNotePath, showNoteIcon, style,
$linkEl?.addClass("tn-link"); $linkEl?.addClass("tn-link");
} }
if (className) {
$linkEl?.addClass(className);
}
return <RawHtml html={jqueryEl} /> return <RawHtml html={jqueryEl} />
} }

View File

@ -61,7 +61,6 @@ class ListOrGridView extends ViewMode<{}> {
.append( .append(
this.viewType === "grid" this.viewType === "grid"
? $('<span class="note-book-title">').text(await treeService.getNoteTitle(note.noteId, this.parentNote.noteId)) ? $('<span class="note-book-title">').text(await treeService.getNoteTitle(note.noteId, this.parentNote.noteId))
: (await linkService.createLink(notePath, { showNotePath: this.showNotePath })).addClass("note-book-title")
) )
.append($renderedAttributes) .append($renderedAttributes)
); );