feat(react/widgets): port close zen button

This commit is contained in:
Elian Doran
2025-08-30 12:04:31 +03:00
parent b3a3196136
commit 3c9a8e38d3
5 changed files with 55 additions and 59 deletions

View File

@@ -0,0 +1,25 @@
import { useState } from "preact/hooks";
import { t } from "../services/i18n";
import ActionButton from "./react/ActionButton";
import { useTriliumEvent } from "./react/hooks";
import "./close_zen_button.css";
export default function CloseZenModeButton() {
const [ zenModeEnabled, setZenModeEnabled ] = useState(false);
useTriliumEvent("zenModeChanged", ({ isEnabled }) => {
setZenModeEnabled(isEnabled);
});
return (
<div class={`close-zen-container ${!zenModeEnabled ? "hidden-ext" : ""}`}>
{zenModeEnabled && (
<ActionButton
icon="bx bxs-yin-yang"
triggerCommand="toggleZenMode"
text={t("zen_mode.button_exit")}
/>
)}
</div>
)
}