mirror of
https://github.com/zadam/trilium.git
synced 2025-11-26 02:24:23 +01:00
chore(react/sidebar): basic right panel widget implementation
This commit is contained in:
parent
6692de33b1
commit
5fc10fe041
@ -44,6 +44,7 @@ import UploadAttachmentsDialog from "../widgets/dialogs/upload_attachments.js";
|
|||||||
import utils from "../services/utils.js";
|
import utils from "../services/utils.js";
|
||||||
import WatchedFileUpdateStatusWidget from "../widgets/watched_file_update_status.js";
|
import WatchedFileUpdateStatusWidget from "../widgets/watched_file_update_status.js";
|
||||||
import NoteDetail from "../widgets/NoteDetail.jsx";
|
import NoteDetail from "../widgets/NoteDetail.jsx";
|
||||||
|
import RightPanelWidget from "../widgets/sidebar/RightPanelWidget.jsx";
|
||||||
|
|
||||||
export default class DesktopLayout {
|
export default class DesktopLayout {
|
||||||
|
|
||||||
|
|||||||
33
apps/client/src/widgets/sidebar/RightPanelWidget.tsx
Normal file
33
apps/client/src/widgets/sidebar/RightPanelWidget.tsx
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import { useContext, useRef } from "preact/hooks";
|
||||||
|
import { ParentComponent } from "../react/react_utils";
|
||||||
|
import { ComponentChildren } from "preact";
|
||||||
|
|
||||||
|
interface RightPanelWidgetProps {
|
||||||
|
title: string;
|
||||||
|
children: ComponentChildren;
|
||||||
|
buttons?: ComponentChildren;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function RightPanelWidget({ title, buttons, children }: RightPanelWidgetProps) {
|
||||||
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
|
const parentComponent = useContext(ParentComponent);
|
||||||
|
|
||||||
|
if (parentComponent) {
|
||||||
|
parentComponent.initialized = Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={containerRef} class="card widget" style={{contain: "none"}}>
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-header-title">{title}</div>
|
||||||
|
<div class="card-header-buttons">{buttons}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id={parentComponent?.componentId} class="body-wrapper">
|
||||||
|
<div class="card-body">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user