mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 17:55:52 +01:00
feat(react/widgets): port toggle sidebar
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
import BasicWidget from "../basic_widget.js";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<button type="button" class="action-button bx bx-sidebar"></button>`;
|
||||
|
||||
class ToggleSidebarButtonWidget extends BasicWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
|
||||
this.$widget.on("click", () =>
|
||||
this.triggerCommand("setActiveScreen", {
|
||||
screen: "tree"
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ToggleSidebarButtonWidget;
|
||||
@@ -0,0 +1,18 @@
|
||||
import { useContext } from "preact/hooks";
|
||||
import ActionButton from "../react/ActionButton";
|
||||
import { ParentComponent } from "../react/react_utils";
|
||||
import { t } from "../../services/i18n";
|
||||
|
||||
export default function ToggleSidebarButton() {
|
||||
const parentComponent = useContext(ParentComponent);
|
||||
|
||||
return (
|
||||
<ActionButton
|
||||
icon="bx bx-sidebar"
|
||||
text={t("note_tree.toggle-sidebar")}
|
||||
onClick={() => parentComponent?.triggerCommand("setActiveScreen", {
|
||||
screen: "tree"
|
||||
})}
|
||||
/>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user