feat(react/ribbon): port similar notes

This commit is contained in:
Elian Doran
2025-08-22 19:27:58 +03:00
parent c5bb310613
commit cc05572a35
8 changed files with 85 additions and 131 deletions

View File

@@ -5,16 +5,21 @@ import RawHtml from "./RawHtml";
interface NoteLinkOpts {
notePath: string | string[];
showNotePath?: boolean;
style?: Record<string, string | number>;
}
export default function NoteLink({ notePath, showNotePath }: NoteLinkOpts) {
export default function NoteLink({ notePath, showNotePath, style }: NoteLinkOpts) {
const stringifiedNotePath = Array.isArray(notePath) ? notePath.join("/") : notePath;
const [ jqueryEl, setJqueryEl ] = useState<JQuery<HTMLElement>>();
useEffect(() => {
link.createLink(stringifiedNotePath, { showNotePath: true })
link.createLink(stringifiedNotePath, { showNotePath })
.then(setJqueryEl);
}, [ stringifiedNotePath, showNotePath ])
}, [ stringifiedNotePath, showNotePath ]);
if (style) {
jqueryEl?.css(style);
}
return <RawHtml html={jqueryEl} />