feat: Add shortcut for dark mode (#3543)

* Create and move toggle into an action

* Add shortcut on help dialog
This commit is contained in:
Arun 2021-05-08 15:17:30 +05:30 committed by GitHub
parent 178ee04d82
commit 198800136e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 13 deletions

View file

@ -1,7 +1,6 @@
import React from "react";
import { ActionManager } from "../actions/manager";
import { AppState } from "../types";
import { DarkModeToggle } from "./DarkModeToggle";
export const BackgroundPickerAndDarkModeToggle = ({
appState,
@ -16,15 +15,6 @@ export const BackgroundPickerAndDarkModeToggle = ({
}) => (
<div style={{ display: "flex" }}>
{actionManager.renderAction("changeViewBackgroundColor")}
{showThemeBtn && (
<div style={{ marginInlineStart: "0.25rem" }}>
<DarkModeToggle
value={appState.theme}
onChange={(theme) => {
setAppState({ theme });
}}
/>
</div>
)}
{showThemeBtn && <>{actionManager.renderAction("toggleTheme")}</>}
</div>
);

View file

@ -231,6 +231,10 @@ export const HelpDialog = ({ onClose }: { onClose?: () => void }) => {
label={t("labels.viewMode")}
shortcuts={[getShortcutKey("Alt+R")]}
/>
<Shortcut
label={t("labels.toggleTheme")}
shortcuts={[getShortcutKey("Alt+Shift+D")]}
/>
</ShortcutIsland>
</Column>
<Column>