chore(react/ribbon): finalize language switcher

This commit is contained in:
Elian Doran
2025-08-22 15:40:15 +03:00
parent eff5b6459d
commit bf0213907e
5 changed files with 34 additions and 186 deletions

View File

@@ -1,6 +1,7 @@
import { t } from "../../services/i18n";
import { openInAppHelpFromUrl } from "../../services/utils";
import "./FormToggle.css";
import HelpButton from "./HelpButton";
interface FormToggleProps {
currentValue: boolean | null;
@@ -36,14 +37,7 @@ export default function FormToggle({ currentValue, helpPage, switchOnName, switc
</div>
</label>
{ helpPage && (
<button
class="switch-help-button icon-action bx bx-help-circle"
type="button"
onClick={() => openInAppHelpFromUrl(helpPage)}
title={t("open-help-page")}
/>
)}
{ helpPage && <HelpButton className="switch-help-button" helpPage={helpPage} />}
</div>
)
}

View File

@@ -0,0 +1,21 @@
import { CSSProperties } from "preact/compat";
import { t } from "../../services/i18n";
import { openInAppHelpFromUrl } from "../../services/utils";
interface HelpButtonProps {
className?: string;
helpPage: string;
style?: CSSProperties;
}
export default function HelpButton({ className, helpPage, style }: HelpButtonProps) {
return (
<button
class={`${className ?? ""} icon-action bx bx-help-circle`}
type="button"
onClick={() => openInAppHelpFromUrl(helpPage)}
title={t("open-help-page")}
style={style}
/>
);
}