Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 6 additions & 36 deletions res/css/_common.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -896,53 +896,23 @@ legend {

@define-mixin composerButtonHighLight {
background: var(--cpd-color-bg-subtle-primary);
&::before {
background-color: var(--cpd-color-icon-primary) !important;
}
color: var(--cpd-color-icon-primary) !important;
}

@define-mixin composerButton $border-radius, $hover-color, $hover-bg {
--size: 26px;
position: relative;
cursor: pointer;
height: var(--size);
line-height: var(--size);
width: auto;
padding-left: var(--size);
border-radius: $border-radius;

&::before {
content: "";
position: absolute;
top: 3px;
left: 3px;
height: 20px;
width: 20px;
background-color: $icon-button-color;
mask-repeat: no-repeat;
mask-size: contain;
mask-position: center;
z-index: 2;
}

&::after {
content: "";
position: absolute;
left: 0;
top: 0;
z-index: 0;
width: var(--size);
height: var(--size);
border-radius: $border-radius;
svg {
color: $icon-button-color;
}

&:hover {
&::after {
background: $hover-bg;
}
background-color: $hover-bg;

&::before {
background-color: $hover-color;
svg {
color: $hover-color;
}
}
}
Expand Down
22 changes: 5 additions & 17 deletions res/css/views/audio_messages/_PlayPauseButton.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,16 @@ Please see LICENSE files in the repository root for full details.
min-height: 32px; /* for when the button is used in a flexbox */
border-radius: 32px;
background-color: $system;
padding: var(--cpd-space-1-5x);
box-sizing: border-box;

&::before {
content: "";
position: absolute; /* sizing varies by icon */
background-color: $secondary-content;
mask-repeat: no-repeat;
mask-size: contain;
top: 6px; /* center */
left: 6px; /* center */
svg {
color: $secondary-content;
width: 20px;
height: 20px;
}

&.mx_PlayPauseButton_disabled::before {
&[disabled] svg {
opacity: 0.5;
}

&.mx_PlayPauseButton_play::before {
mask-image: url("@vector-im/compound-design-tokens/icons/play-solid.svg");
}

&.mx_PlayPauseButton_pause::before {
mask-image: url("@vector-im/compound-design-tokens/icons/pause-solid.svg");
}
}
23 changes: 17 additions & 6 deletions res/css/views/context_menus/_IconizedContextMenu.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,16 @@ Please see LICENSE files in the repository root for full details.
}

img,
svg,
.mx_IconizedContextMenu_icon {
/* icons */
width: 16px;
min-width: 16px;
max-width: 16px;

& + .mx_IconizedContextMenu_label {
padding-left: 14px;
}
}

span.mx_IconizedContextMenu_label {
Expand All @@ -87,10 +92,6 @@ Please see LICENSE files in the repository root for full details.
white-space: nowrap;
}

.mx_IconizedContextMenu_icon + .mx_IconizedContextMenu_label {
padding-left: 14px;
}

.mx_BetaCard_betaPill {
margin-left: 16px;
}
Expand All @@ -99,8 +100,6 @@ Please see LICENSE files in the repository root for full details.

.mx_IconizedContextMenu_icon {
position: relative;
width: 16px;
height: 16px;

&::before {
content: "";
Expand All @@ -119,6 +118,10 @@ Please see LICENSE files in the repository root for full details.
color: $alert !important;
}

svg {
color: var(--cpd-color-icon-critical-primary);
}

.mx_IconizedContextMenu_icon::before {
background-color: var(--cpd-color-icon-critical-primary);
}
Expand All @@ -127,6 +130,10 @@ Please see LICENSE files in the repository root for full details.
.mx_IconizedContextMenu_option_red {
color: $alert !important;

svg {
color: $alert;
}

.mx_IconizedContextMenu_icon::before {
background-color: $alert;
}
Expand All @@ -138,6 +145,10 @@ Please see LICENSE files in the repository root for full details.
color: $accent !important;
}

svg {
color: $accent;
}

.mx_IconizedContextMenu_icon::before {
background-color: $accent;
}
Expand Down
4 changes: 0 additions & 4 deletions res/css/views/rooms/_EmojiButton.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ Please see LICENSE files in the repository root for full details.
@mixin composerButtonHighLight;
}

.mx_EmojiButton_icon::before {
mask-image: url("$(res)/img/element-icons/room/composer/emoji.svg");
}

.mx_MessageComposer_wysiwyg {
.mx_EmojiButton {
@mixin composerButton 5px, $tertiary-content, $panels;
Expand Down
71 changes: 25 additions & 46 deletions res/css/views/rooms/_MessageComposer.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ Please see LICENSE files in the repository root for full details.

.mx_MessageComposer_button {
@mixin composerButton 50%, var(--cpd-color-icon-primary), var(--cpd-color-bg-subtle-primary);
padding: 3px;
height: 20px;
width: 20px;

&:last-child {
margin-right: auto;
Expand All @@ -202,6 +205,12 @@ Please see LICENSE files in the repository root for full details.
&.mx_MessageComposer_hangup:not(.mx_AccessibleButton_disabled)::before {
background-color: $alert;
}

svg {
--size: 20px;
width: var(--size);
height: var(--size);
}
}
.mx_MessageComposer_wysiwyg {
.mx_MessageComposer_wrapper {
Expand Down Expand Up @@ -244,61 +253,31 @@ Please see LICENSE files in the repository root for full details.
}
}

.mx_MessageComposer_upload::before {
mask-image: url("$(res)/img/element-icons/room/composer/attach.svg");
}

.mx_MessageComposer_poll::before {
mask-image: url("$(res)/img/element-icons/room/composer/poll.svg");
}

.mx_MessageComposer_voiceMessage::before {
mask-image: url("@vector-im/compound-design-tokens/icons/mic-on-solid.svg");
}

.mx_MessageComposer_plain_text::before {
mask-image: url("$(res)/img/element-icons/room/composer/plain_text.svg");
}

.mx_MessageComposer_rich_text::before {
mask-image: url("@vector-im/compound-design-tokens/icons/text-formatting.svg");
}
.mx_MessageComposer_buttonMenu {
width: 24px;
height: 24px;
padding: 1px;

.mx_MessageComposer_location::before {
mask-image: url("@vector-im/compound-design-tokens/icons/location-pin-solid.svg");
}

.mx_MessageComposer_stickers::before {
mask-image: url("$(res)/img/element-icons/room/composer/sticker.svg");
}

.mx_MessageComposer_buttonMenu::before {
mask-image: url("@vector-im/compound-design-tokens/icons/overflow-horizontal.svg");
mask-size: 24px;
svg {
width: 24px;
height: 24px;
}
}

.mx_MessageComposer_sendMessage {
cursor: pointer;
position: relative;
width: 32px;
height: 32px;
padding: var(--cpd-space-2x);
border-radius: 100%;
background-color: var(--cpd-color-icon-accent-tertiary);
height: 16px;
width: 16px;

&::before {
position: absolute;
height: 16px;
width: 16px;
top: 8px;
left: 9px;

mask-image: url("@vector-im/compound-design-tokens/icons/send-solid.svg");
mask-repeat: no-repeat;
mask-size: contain;
mask-position: center;

background-color: var(--cpd-color-icon-on-solid-primary);
content: "";
svg {
height: inherit;
width: inherit;

color: var(--cpd-color-icon-on-solid-primary);
}
}

Expand Down
16 changes: 12 additions & 4 deletions res/css/views/rooms/_VoiceRecordComposerTile.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ Please see LICENSE files in the repository root for full details.
height: 24px;
vertical-align: middle;
margin-right: 2px; /* distance from left edge of waveform container (container has some margin too) */
background-color: $voice-record-icon-color;
mask-repeat: no-repeat;
mask-size: contain;
mask-image: url("@vector-im/compound-design-tokens/icons/delete.svg");

svg {
width: inherit;
height: inherit;
color: $voice-record-icon-color;
}
}

.mx_VoiceRecordComposerTile_uploadingState {
Expand Down Expand Up @@ -115,3 +117,9 @@ Please see LICENSE files in the repository root for full details.
opacity: 1;
}
}

@media (forced-colors: active) {
.mx_VoiceMessagePrimaryContainer {
outline: 1px solid transparent;
}
}
2 changes: 1 addition & 1 deletion res/img/element-icons/room/composer/attach.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions res/img/element-icons/room/composer/emoji.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 9 additions & 19 deletions src/components/views/audio_messages/PlayPauseButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/

import React, { type ReactNode } from "react";
import classNames from "classnames";
import React, { type HTMLAttributes, type ReactNode } from "react";
import { PlayPauseButton as SharedPlayPauseButton } from "@element-hq/web-shared-components";

import { _t } from "../../../languageHandler";
import { type Playback, PlaybackState } from "../../../audio/Playback";
import AccessibleButton, { type ButtonProps } from "../elements/AccessibleButton";

type Props = Omit<ButtonProps<"div">, "title" | "onClick" | "disabled" | "element" | "ref"> & {
type Props = HTMLAttributes<HTMLButtonElement> & {
// Playback instance to manipulate. Cannot change during the component lifecycle.
playback: Playback;

Expand All @@ -27,8 +25,7 @@ type Props = Omit<ButtonProps<"div">, "title" | "onClick" | "disabled" | "elemen
*/
export default class PlayPauseButton extends React.PureComponent<Props> {
private onClick = (): void => {
// noinspection JSIgnoredPromiseFromCall
this.toggleState();
void this.toggleState();
};

public async toggleState(): Promise<void> {
Expand All @@ -37,21 +34,14 @@ export default class PlayPauseButton extends React.PureComponent<Props> {

public render(): ReactNode {
const { playback, playbackPhase, ...restProps } = this.props;
const isPlaying = playback.isPlaying;
const isDisabled = playbackPhase === PlaybackState.Decoding;
const classes = classNames("mx_PlayPauseButton", {
mx_PlayPauseButton_play: !isPlaying,
mx_PlayPauseButton_pause: isPlaying,
mx_PlayPauseButton_disabled: isDisabled,
});

return (
<AccessibleButton
<SharedPlayPauseButton
data-testid="play-pause-button"
className={classes}
title={isPlaying ? _t("action|pause") : _t("action|play")}
onClick={this.onClick}
disabled={isDisabled}
className="mx_PlayPauseButton"
togglePlay={this.onClick}
playing={playback.isPlaying}
disabled={playbackPhase === PlaybackState.Decoding}
{...restProps}
/>
);
Expand Down
3 changes: 3 additions & 0 deletions src/components/views/context_menus/IconizedContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ interface IOptionListProps {
}

interface IOptionProps extends React.ComponentProps<typeof MenuItem> {
icon?: ReactNode;
iconClassName?: string;
isDestructive?: boolean;
}
Expand Down Expand Up @@ -114,6 +115,7 @@ export const IconizedContextMenuOption: React.FC<IOptionProps> = ({
label,
className,
iconClassName,
icon,
children,
isDestructive,
...props
Expand All @@ -129,6 +131,7 @@ export const IconizedContextMenuOption: React.FC<IOptionProps> = ({
label={label}
>
{iconClassName && <span className={classNames("mx_IconizedContextMenu_icon", iconClassName)} />}
{icon}
<span className="mx_IconizedContextMenu_label">{label}</span>
{children}
</MenuItem>
Expand Down
Loading
Loading