Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 3537699

Browse files
authored
Revert "Implement new toast UI (#10467)" (#10740)
This reverts commit 7632f36.
1 parent f819853 commit 3537699

File tree

12 files changed

+67
-87
lines changed

12 files changed

+67
-87
lines changed

res/css/compound/_Icon.pcss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ limitations under the License.
2424
box-sizing: border-box;
2525
}
2626

27-
.mx_Icon_secondary-content {
28-
color: $secondary-content;
29-
}
30-
3127
.mx_Icon_accent {
3228
color: $accent;
3329
}

res/css/structures/_ToastContainer.pcss

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ limitations under the License.
1616

1717
.mx_ToastContainer {
1818
position: absolute;
19-
top: $spacing-4;
19+
top: 0;
2020
left: 70px;
2121
z-index: 101;
22+
padding: 4px;
2223
display: grid;
2324
grid-template-rows: 1fr 14px 6px;
2425

@@ -33,29 +34,25 @@ limitations under the License.
3334
}
3435

3536
.mx_Toast_toast {
37+
grid-row: 1 / 3;
38+
grid-column: 1;
3639
background-color: $system;
37-
border-radius: 8px;
38-
box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.5);
3940
color: $primary-content;
40-
column-gap: $spacing-8;
41-
display: grid;
42-
grid-column: 1;
43-
grid-row: 1 / 3;
44-
grid-template-columns: 24px 1fr;
41+
box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.5);
42+
border-radius: 8px;
4543
overflow: hidden;
46-
padding: $spacing-16;
44+
display: grid;
45+
grid-template-columns: 22px 1fr;
46+
column-gap: 8px;
47+
row-gap: 4px;
48+
padding: 8px;
4749

4850
&.mx_Toast_hasIcon {
49-
.mx_Toast_icon {
50-
grid-column: 1;
51-
grid-row: 1;
52-
}
53-
5451
&::before,
5552
&::after {
5653
content: "";
57-
width: 24px;
58-
height: 24px;
54+
width: 22px;
55+
height: 22px;
5956
grid-column: 1;
6057
grid-row: 1;
6158
mask-size: 100%;
@@ -65,6 +62,11 @@ limitations under the License.
6562
background-repeat: no-repeat;
6663
}
6764

65+
&.mx_Toast_icon_verification::after {
66+
mask-image: url("$(res)/img/e2e/normal.svg");
67+
background-color: $primary-content;
68+
}
69+
6870
&.mx_Toast_icon_verification_warning {
6971
/* white infill for the hollow svg mask */
7072
&::before {
@@ -94,7 +96,6 @@ limitations under the License.
9496
grid-column: 2;
9597
}
9698
}
97-
9899
&:not(.mx_Toast_hasIcon) {
99100
padding-left: 12px;
100101

@@ -103,19 +104,24 @@ limitations under the License.
103104
}
104105
}
105106

107+
.mx_Toast_title,
108+
.mx_Toast_description {
109+
padding-right: 8px;
110+
}
111+
106112
.mx_Toast_title {
113+
display: flex;
107114
align-items: center;
108-
box-sizing: border-box;
109115
column-gap: 8px;
110-
display: flex;
111-
margin-bottom: $spacing-16;
112116
width: 100%;
117+
box-sizing: border-box;
113118

114119
h2 {
115-
color: $primary-content;
116120
margin: 0;
117-
font-size: $font-18px;
121+
font-size: $font-15px;
118122
font-weight: var(--font-semi-bold);
123+
display: inline;
124+
width: auto;
119125
}
120126

121127
.mx_Toast_title_countIndicator {
@@ -129,32 +135,33 @@ limitations under the License.
129135
.mx_Toast_body {
130136
grid-column: 1 / 3;
131137
grid-row: 2;
132-
position: relative;
133138
}
134139

135140
.mx_Toast_buttons {
136-
column-gap: $spacing-8;
137141
display: flex;
138142
justify-content: flex-end;
139-
margin-top: $spacing-32;
143+
column-gap: 5px;
144+
145+
.mx_AccessibleButton {
146+
min-width: 96px;
147+
box-sizing: border-box;
148+
}
140149
}
141150

142151
.mx_Toast_description {
143-
color: $primary-content;
144-
font-size: $font-15px;
145-
font-weight: var(--font-semi-bold);
146-
max-width: 300px;
152+
max-width: 272px;
153+
overflow: hidden;
154+
text-overflow: ellipsis;
155+
margin: 4px 0 11px 0;
156+
font-size: $font-12px;
147157

148158
a {
149159
text-decoration: none;
150160
}
151161
}
152162

153163
.mx_Toast_detail {
154-
display: block;
155-
font-weight: var(--font-normal);
156-
margin-top: $spacing-4;
157-
max-width: 300px;
164+
color: $secondary-content;
158165
}
159166

160167
.mx_Toast_deviceID {

res/css/views/toasts/_IncomingLegacyCallToast.pcss

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,20 @@ limitations under the License.
8484
}
8585

8686
.mx_IncomingLegacyCallToast_buttons {
87+
margin-top: 8px;
88+
display: flex;
89+
flex-direction: row;
90+
gap: 12px;
91+
8792
.mx_IncomingLegacyCallToast_button {
93+
@mixin LegacyCallButton;
94+
padding: 0px 8px;
95+
flex-shrink: 0;
96+
flex-grow: 1;
97+
font-size: $font-15px;
98+
8899
span {
89-
align-items: center;
90-
display: flex;
91-
92-
&::before {
93-
background-color: $button-fg-color;
94-
content: "";
95-
display: inline-block;
96-
margin-right: 8px;
97-
mask-position: center;
98-
mask-repeat: no-repeat;
99-
}
100+
padding: 8px 0;
100101
}
101102

102103
&.mx_IncomingLegacyCallToast_button_accept span::before {
@@ -132,13 +133,6 @@ limitations under the License.
132133
}
133134
}
134135

135-
.mx_IncomingLegacyCallToast_silence,
136-
.mx_IncomingLegacyCallToast_unSilence {
137-
position: absolute;
138-
right: 0;
139-
top: 0;
140-
}
141-
142136
.mx_IncomingLegacyCallToast_silence::before {
143137
mask-image: url("$(res)/img/voip/silence.svg");
144138
}

res/img/compound/encryption-24px.svg

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/components/structures/MatrixChat.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ import { findDMForUser } from "../../utils/dm/findDMForUser";
143143
import { Linkify } from "../../HtmlUtils";
144144
import { NotificationColor } from "../../stores/notifications/NotificationColor";
145145
import { UserTab } from "../views/dialogs/UserTab";
146-
import { Icon as EncryptionIcon } from "../../../res/img/compound/encryption-24px.svg";
146+
147147
// legacy export
148148
export { default as Views } from "../../Views";
149149

@@ -1668,9 +1668,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
16681668
ToastStore.sharedInstance().addOrReplaceToast({
16691669
key: "verifreq_" + request.channel.transactionId,
16701670
title: _t("Verification requested"),
1671-
iconElement: (
1672-
<EncryptionIcon className="mx_Icon mx_Icon_24 mx_Icon_secondary-content mx_Toast_icon" />
1673-
),
1671+
icon: "verification",
16741672
props: { request },
16751673
component: VerificationRequestToast,
16761674
priority: 90,

src/components/structures/ToastContainer.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ export default class ToastContainer extends React.Component<{}, IState> {
5757
let containerClasses;
5858
if (totalCount !== 0) {
5959
const topToast = this.state.toasts[0];
60-
const { title, icon, iconElement, key, component, className, bodyClassName, props } = topToast;
60+
const { title, icon, key, component, className, bodyClassName, props } = topToast;
6161
const bodyClasses = classNames("mx_Toast_body", bodyClassName);
6262
const toastClasses = classNames("mx_Toast_toast", className, {
63-
mx_Toast_hasIcon: icon || iconElement,
63+
mx_Toast_hasIcon: icon,
6464
[`mx_Toast_icon_${icon}`]: icon,
6565
});
6666
const toastProps = Object.assign({}, props, {
@@ -86,7 +86,6 @@ export default class ToastContainer extends React.Component<{}, IState> {
8686

8787
toast = (
8888
<div className={toastClasses}>
89-
{iconElement}
9089
{titleElement}
9190
<div className={bodyClasses}>{content}</div>
9291
</div>

src/components/views/toasts/GenericToast.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import React, { ReactNode } from "react";
1818

1919
import AccessibleButton from "../elements/AccessibleButton";
2020
import { XOR } from "../../../@types/common";
21-
import { Caption } from "../typography/Caption";
2221

2322
export interface IProps {
2423
description: ReactNode;
@@ -41,7 +40,7 @@ const GenericToast: React.FC<XOR<IPropsExtended, IProps>> = ({
4140
onAccept,
4241
onReject,
4342
}) => {
44-
const detailContent = detail ? <Caption className="mx_Toast_detail">{detail}</Caption> : null;
43+
const detailContent = detail ? <div className="mx_Toast_detail">{detail}</div> : null;
4544

4645
return (
4746
<div>

src/components/views/typography/Caption.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ import React, { HTMLAttributes } from "react";
1919

2020
interface Props extends Omit<HTMLAttributes<HTMLSpanElement>, "className"> {
2121
children: React.ReactNode;
22-
className?: string;
2322
isError?: boolean;
2423
}
2524

26-
export const Caption: React.FC<Props> = ({ children, className, isError, ...rest }) => {
25+
export const Caption: React.FC<Props> = ({ children, isError, ...rest }) => {
2726
return (
2827
<span
29-
className={classNames("mx_Caption", className, {
28+
className={classNames("mx_Caption", {
3029
mx_Caption_error: isError,
3130
})}
3231
{...rest}

src/stores/ToastStore.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License.
1515
*/
1616

1717
import EventEmitter from "events";
18-
import React, { ReactElement } from "react";
18+
import React from "react";
1919

2020
import { ComponentClass } from "../@types/common";
2121

@@ -24,14 +24,7 @@ export interface IToast<C extends ComponentClass> {
2424
// higher priority number will be shown on top of lower priority
2525
priority: number;
2626
title?: string;
27-
/**
28-
* Icon class.
29-
*
30-
* @deprecated Use iconElement instead.
31-
*/
3227
icon?: string;
33-
/** Icon element. Displayed left of the title. */
34-
iconElement?: ReactElement;
3528
component: C;
3629
className?: string;
3730
bodyClassName?: string;

src/toasts/IncomingLegacyCallToast.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default class IncomingLegacyCallToast extends React.Component<IProps, ISt
119119
<div className="mx_LegacyCallEvent_type_icon" />
120120
{isVoice ? _t("Voice call") : _t("Video call")}
121121
</div>
122-
<div className="mx_Toast_buttons mx_IncomingLegacyCallToast_buttons">
122+
<div className="mx_IncomingLegacyCallToast_buttons">
123123
<AccessibleButton
124124
className="mx_IncomingLegacyCallToast_button mx_IncomingLegacyCallToast_button_decline"
125125
onClick={this.onRejectClick}

0 commit comments

Comments
 (0)