mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 11:09:05 +01:00
chore(react/ribbon): similar notes style
This commit is contained in:
parent
6c30e0836f
commit
2c33ef2b0d
@ -7,9 +7,10 @@ interface NoteLinkOpts {
|
|||||||
showNotePath?: boolean;
|
showNotePath?: boolean;
|
||||||
style?: Record<string, string | number>;
|
style?: Record<string, string | number>;
|
||||||
noPreview?: boolean;
|
noPreview?: boolean;
|
||||||
|
noTnLink?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function NoteLink({ notePath, showNotePath, style, noPreview }: NoteLinkOpts) {
|
export default function NoteLink({ notePath, showNotePath, 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>>();
|
||||||
|
|
||||||
@ -27,7 +28,9 @@ export default function NoteLink({ notePath, showNotePath, style, noPreview }: N
|
|||||||
$linkEl?.addClass("no-tooltip-preview");
|
$linkEl?.addClass("no-tooltip-preview");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!noTnLink) {
|
||||||
$linkEl?.addClass("tn-link");
|
$linkEl?.addClass("tn-link");
|
||||||
|
}
|
||||||
|
|
||||||
return <RawHtml html={jqueryEl} />
|
return <RawHtml html={jqueryEl} />
|
||||||
|
|
||||||
|
|||||||
@ -23,18 +23,24 @@ export default function SimilarNotesTab({ note }: TabContext) {
|
|||||||
}, [ note?.noteId ]);
|
}, [ note?.noteId ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<div className="similar-notes-widget">
|
||||||
<div className="similar-notes-wrapper">
|
<div className="similar-notes-wrapper">
|
||||||
{similarNotes?.length ? (
|
{similarNotes?.length ? (
|
||||||
<div>
|
<div>
|
||||||
{similarNotes.map(({notePath, score}) => (
|
{similarNotes.map(({notePath, score}) => (
|
||||||
<NoteLink notePath={notePath} style={{
|
<NoteLink
|
||||||
|
notePath={notePath}
|
||||||
|
noTnLink
|
||||||
|
style={{
|
||||||
"font-size": 24 * (1 - 1 / (1 + score))
|
"font-size": 24 * (1 - 1 / (1 + score))
|
||||||
}}/>
|
}}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<>{t("similar_notes.no_similar_notes_found")}</>
|
<>{t("similar_notes.no_similar_notes_found")}</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user