diff --git a/commafeed-client/src/components/ActionButton.tsx b/commafeed-client/src/components/ActionButton.tsx index 6d8ab3a4..9f3feae9 100644 --- a/commafeed-client/src/components/ActionButton.tsx +++ b/commafeed-client/src/components/ActionButton.tsx @@ -1,6 +1,6 @@ import type { MessageDescriptor } from "@lingui/core" import { useLingui } from "@lingui/react" -import { ActionIcon, Button, type ButtonVariant, Tooltip, useMantineTheme } from "@mantine/core" +import { ActionIcon, Box, Button, type ButtonVariant, Tooltip, useMantineTheme } from "@mantine/core" import type { ActionIconVariant } from "@mantine/core/lib/components/ActionIcon/ActionIcon" import { Constants } from "app/constants" import { useActionButton } from "hooks/useActionButton" @@ -19,7 +19,7 @@ interface ActionButtonProps { /** * Switches between Button with label (desktop) and ActionIcon (mobile) */ -export const ActionButton = forwardRef((props: ActionButtonProps, ref) => { +export const ActionButton = forwardRef((props: ActionButtonProps, ref) => { const { mobile } = useActionButton() const theme = useMantineTheme() const { _ } = useLingui() @@ -27,31 +27,36 @@ export const ActionButton = forwardRef((pr const label = typeof props.label === "string" ? props.label : props.label && _(props.label) const variant = props.variant ?? "subtle" const iconOnly = (mobile && !props.showLabelOnMobile) || (!mobile && props.hideLabelOnDesktop) - return iconOnly ? ( - - - {props.icon} - - - ) : ( - + + return ( + + {iconOnly && ( + + + {props.icon} + + + )} + {!iconOnly && ( + + )} + ) }) + ActionButton.displayName = "HeaderButton"