mirror of
https://github.com/zadam/trilium.git
synced 2025-10-28 18:18:55 +01:00
feat(react): basic integration for basic widget & modal
This commit is contained in:
parent
3361a2e4ab
commit
efeb9b90ca
11
apps/client/src/widgets/react/Modal.tsx
Normal file
11
apps/client/src/widgets/react/Modal.tsx
Normal file
@ -0,0 +1,11 @@
|
||||
export default function Modal({ children }) {
|
||||
return (
|
||||
<div className="modal fade mx-auto" tabIndex={-1} role="dialog">
|
||||
<div className="modal-dialog" role="document">
|
||||
<div className="modal-content">
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
14
apps/client/src/widgets/react/ReactBasicWidget.ts
Normal file
14
apps/client/src/widgets/react/ReactBasicWidget.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { JSX, render } from "preact";
|
||||
import BasicWidget from "../basic_widget.js";
|
||||
|
||||
export default abstract class ReactBasicWidget extends BasicWidget {
|
||||
|
||||
abstract get component(): JSX.Element;
|
||||
|
||||
doRender() {
|
||||
const renderContainer = new DocumentFragment();
|
||||
render(this.component, renderContainer);
|
||||
this.$widget = $(renderContainer.firstChild as HTMLElement);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user