diff --git a/res/css/views/rooms/wysiwyg_composer/components/_FormattingButtons.pcss b/res/css/views/rooms/wysiwyg_composer/components/_FormattingButtons.pcss index fa8078279f..8e3dd22c99 100644 --- a/res/css/views/rooms/wysiwyg_composer/components/_FormattingButtons.pcss +++ b/res/css/views/rooms/wysiwyg_composer/components/_FormattingButtons.pcss @@ -50,6 +50,12 @@ limitations under the License. } } + .mx_FormattingButtons_disabled { + .mx_FormattingButtons_Icon { + color: $quinary-content; + } + } + .mx_FormattingButtons_Icon { --size: 16px; height: var(--size); diff --git a/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx b/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx index 7c1601b441..11c797d646 100644 --- a/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx +++ b/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import React, { MouseEventHandler, ReactNode } from "react"; -import { FormattingFunctions, AllActionStates } from "@matrix-org/matrix-wysiwyg"; +import { FormattingFunctions, AllActionStates, ActionState } from "@matrix-org/matrix-wysiwyg"; import classNames from "classnames"; import { Icon as BoldIcon } from "../../../../../../res/img/element-icons/room/composer/bold.svg"; @@ -53,21 +53,23 @@ function Tooltip({ label, keyCombo }: TooltipProps): JSX.Element { interface ButtonProps extends TooltipProps { icon: ReactNode; - isActive: boolean; + actionState: ActionState; onClick: MouseEventHandler; } -function Button({ label, keyCombo, onClick, isActive, icon }: ButtonProps): JSX.Element { +function Button({ label, keyCombo, onClick, actionState, icon }: ButtonProps): JSX.Element { return ( void} title={label} className={classNames("mx_FormattingButtons_Button", { - mx_FormattingButtons_active: isActive, - mx_FormattingButtons_Button_hover: !isActive, + mx_FormattingButtons_active: actionState === "reversed", + mx_FormattingButtons_Button_hover: actionState === "enabled", + mx_FormattingButtons_disabled: actionState === "disabled", })} tooltip={keyCombo && } + forceHide={actionState === "disabled"} alignment={Alignment.Top} > {icon} @@ -85,53 +87,53 @@ export function FormattingButtons({ composer, actionStates }: FormattingButtonsP return (