Skip to content

Commit b26ca5f

Browse files
committed
Add white background to E2E Warning Icon
Also adapted the testcases to the new background.
1 parent c2f5421 commit b26ca5f

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

res/css/views/rooms/_E2EIcon.pcss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ Please see LICENSE files in the repository root for full details.
6060
background-color: $e2e-verified-color;
6161
}
6262

63-
.mx_E2EIcon_verified .mx_E2EIcon_normal::after {
63+
// When using the "normal" icon as a background for verified or warning icon,
64+
// it should be slightly smaller than the foreground icon
65+
.mx_E2EIcon_verified, .mx_E2EIcon_warning .mx_E2EIcon_normal::after {
6466
mask-size: 90%;
6567
background-color: white;
6668
}

src/components/views/rooms/E2EIcon.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,14 @@ const E2EIcon: React.FC<Props> = ({
7676
if (onClick) {
7777
content = <AccessibleButton onClick={onClick} className={classes} style={style} />;
7878
} else {
79-
if (status === E2EStatus.Verified) {
80-
content = <div className={classes} style={style}><div className="mx_E2EIcon_normal" /></div>;
79+
// Verified and warning icon have a transparent cutout, so add a white background.
80+
// The normal icon already has the correct shape and size, so reuse that.
81+
if (status === E2EStatus.Verified || status === E2EStatus.Warning) {
82+
content = (
83+
<div className={classes} style={style}>
84+
<div className="mx_E2EIcon_normal" />
85+
</div>
86+
);
8187
} else {
8288
content = <div className={classes} style={style} />;
8389
}

test/unit-tests/components/views/dialogs/__snapshots__/UntrustedDeviceDialog-test.tsx.snap

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ exports[`<UntrustedDeviceDialog /> should display the dialog for the device of a
2323
<div
2424
class="mx_E2EIcon mx_E2EIcon_warning"
2525
style="width: 24px; height: 24px;"
26-
/>
26+
>
27+
<div
28+
class="mx_E2EIcon_normal"
29+
/>
30+
</div>
2731
Not Trusted
2832
</h1>
2933
</div>
@@ -97,7 +101,11 @@ exports[`<UntrustedDeviceDialog /> should display the dialog for the device of t
97101
<div
98102
class="mx_E2EIcon mx_E2EIcon_warning"
99103
style="width: 24px; height: 24px;"
100-
/>
104+
>
105+
<div
106+
class="mx_E2EIcon_normal"
107+
/>
108+
</div>
101109
Not Trusted
102110
</h1>
103111
</div>

0 commit comments

Comments
 (0)