fix: Submenus get stuck open, closes #2938
This commit is contained in:
@@ -36,7 +36,8 @@ export const changeToSystemTheme = createAction({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const changeTheme = createAction({
|
export const changeTheme = createAction({
|
||||||
name: ({ t }) => t("Change theme"),
|
name: ({ t, isContextMenu }) =>
|
||||||
|
isContextMenu ? t("Appearance") : t("Change theme"),
|
||||||
placeholder: ({ t }) => t("Change theme to"),
|
placeholder: ({ t }) => t("Change theme to"),
|
||||||
icon: () =>
|
icon: () =>
|
||||||
stores.ui.resolvedTheme === "light" ? <SunIcon /> : <MoonIcon />,
|
stores.ui.resolvedTheme === "light" ? <SunIcon /> : <MoonIcon />,
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ export const MenuAnchorCSS = css<{ level?: number; disabled?: boolean }>`
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
svg:not(:last-child) {
|
svg:not(:last-child) {
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
MenuButton,
|
MenuButton,
|
||||||
MenuItem as BaseMenuItem,
|
MenuItem as BaseMenuItem,
|
||||||
} from "reakit/Menu";
|
} from "reakit/Menu";
|
||||||
import styled from "styled-components";
|
import styled, { useTheme } from "styled-components";
|
||||||
import Flex from "~/components/Flex";
|
import Flex from "~/components/Flex";
|
||||||
import MenuIconWrapper from "~/components/MenuIconWrapper";
|
import MenuIconWrapper from "~/components/MenuIconWrapper";
|
||||||
import { actionToMenuItem } from "~/actions";
|
import { actionToMenuItem } from "~/actions";
|
||||||
@@ -46,16 +46,15 @@ const Submenu = React.forwardRef(
|
|||||||
ref: React.LegacyRef<HTMLButtonElement>
|
ref: React.LegacyRef<HTMLButtonElement>
|
||||||
) => {
|
) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const menu = useMenuState({
|
const theme = useTheme();
|
||||||
modal: true,
|
const menu = useMenuState();
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MenuButton ref={ref} {...menu} {...rest}>
|
<MenuButton ref={ref} {...menu} {...rest}>
|
||||||
{(props) => (
|
{(props) => (
|
||||||
<MenuAnchor {...props}>
|
<MenuAnchor {...props}>
|
||||||
{title} <Disclosure color="currentColor" />
|
{title} <Disclosure color={theme.textTertiary} />
|
||||||
</MenuAnchor>
|
</MenuAnchor>
|
||||||
)}
|
)}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
|
|||||||
Reference in New Issue
Block a user