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

Usability fixes for new room header #11729

Merged
merged 6 commits into from
Oct 11, 2023
Merged
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
37 changes: 28 additions & 9 deletions res/css/views/rooms/_RoomHeader.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,29 @@ limitations under the License.
padding: 0 var(--cpd-space-3x);
border-bottom: 1px solid $separator;
background-color: $background;
transition: all 0.3s ease;
cursor: pointer;
}

.mx_RoomHeader:hover {
background-color: $header-panel-bg-hover;
}

.mx_RoomHeader_info {
cursor: pointer;
flex: 1;
/* We want the spacing to be 64px, 13x = 52px but we have a flex gap of
12px set on the flex container, which sums up to 64 */
padding-right: var(--cpd-space-13x);
}

.mx_RoomHeader_truncated {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;

overflow: hidden;
word-break: break-all;
text-overflow: ellipsis;
}

.mx_RoomHeader_heading {
Expand All @@ -35,14 +53,6 @@ limitations under the License.
.mx_RoomHeader_topic {
height: 0;
opacity: 0;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;

overflow: hidden;
word-break: break-all;
text-overflow: ellipsis;

transition: all var(--transition-standard) ease 0.1s;
}

Expand All @@ -51,10 +61,19 @@ limitations under the License.
value in pixels */
height: calc($font-13px * 1.5);
opacity: 1;

a:hover {
text-decoration: underline;
}
}

.mx_RoomHeader_icon {
flex-shrink: 0;
}

.mx_RoomHeader .mx_FacePile {
color: $secondary-content;
background: $background;
display: flex;
align-items: center;
gap: var(--cpd-space-2x);
Expand Down
1 change: 1 addition & 0 deletions res/themes/dark/css/_dark.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ $accent-1400: var(--cpd-color-green-1400);
/* ******************** */
$inverted-bg-color: var(--cpd-color-bg-action-primary-rest);
$header-panel-bg-color: var(--cpd-color-bg-subtle-secondary);
$header-panel-bg-hover: var(--cpd-color-gray-200);
/* ******************** */

/* Theme specific colors */
Expand Down
1 change: 1 addition & 0 deletions res/themes/legacy-dark/css/_legacy-dark.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ $bg-color: #181b21;
$base-color: #15171b;
$base-text-color: #edf3ff;
$header-panel-bg-color: #22262e;
$header-panel-bg-hover: var(--cpd-color-gray-200);
$header-panel-text-primary-color: #a1b2d1;
$header-panel-text-secondary-color: #c8c8cd;
$text-primary-color: #edf3ff;
Expand Down
1 change: 1 addition & 0 deletions res/themes/legacy-light/css/_legacy-light.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ $monospace-font-family: "Inconsolata", "Twemoji", "Apple Color Emoji", "Segoe UI
/* unified palette */
/* try to use these colors when possible */
$header-panel-bg-color: #f3f8fd;
$header-panel-bg-hover: var(--cpd-color-gray-200);

/* typical text (dark-on-white in light skin) */
$primary-fg-color: #2e2f32;
Expand Down
1 change: 1 addition & 0 deletions res/themes/light-custom/css/_custom.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ $dialog-backdrop-color: var(--sidebar-color-50pct);

/* --roomlist-background-color */
$header-panel-bg-color: var(--roomlist-background-color);
$header-panel-bg-hover: var(--cpd-color-gray-200);
$panel-gradient: var(--roomlist-background-color-0pct), var(--roomlist-background-color);
/* these were #f2f5f8 instead of #f3f8fd, but close enough */
$dark-panel-bg-color: var(--roomlist-background-color);
Expand Down
1 change: 1 addition & 0 deletions res/themes/light/css/_light.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ $accent-1400: var(--cpd-color-green-1400);
/* ******************** */
$inverted-bg-color: var(--cpd-color-bg-action-primary-rest);
$header-panel-bg-color: var(--cpd-color-bg-subtle-primary);
$header-panel-bg-hover: var(--cpd-color-gray-200);
/* ******************** */

/* Theme specific colors */
Expand Down
10 changes: 4 additions & 6 deletions src/components/views/elements/FacePile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,10 @@ const FacePile: FC<IProps> = ({
);

const content = (
<div className="mx_FacePile">
<AccessibleButton kind="link_inline" onClick={props.onClick ?? null}>
<AvatarStack>{pileContents}</AvatarStack>
{children}
</AccessibleButton>
</div>
<AccessibleButton className="mx_FacePile" kind="link_inline" onClick={props.onClick ?? null}>
<AvatarStack>{pileContents}</AvatarStack>
{children}
</AccessibleButton>
);

return tooltipLabel ? (
Expand Down
17 changes: 8 additions & 9 deletions src/components/views/rooms/RoomHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,48 +123,47 @@ export default function RoomHeader({ room }: { room: Room }): JSX.Element {
size="lg"
weight="semibold"
dir="auto"
title={roomName}
role="heading"
aria-level={1}
className="mx_RoomHeader_heading"
>
{roomName}
<span className="mx_RoomHeader_truncated">{roomName}</span>

{!isDirectMessage && roomState.getJoinRule() === JoinRule.Public && (
<Tooltip label={_t("common|public_room")}>
<Tooltip label={_t("common|public_room")} side="right">
<PublicIcon
width="16px"
height="16px"
className="text-secondary"
className="mx_RoomHeader_icon text-secondary"
aria-label={_t("common|public_room")}
/>
</Tooltip>
)}

{isDirectMessage && e2eStatus === E2EStatus.Verified && (
<Tooltip label={_t("common|verified")}>
<Tooltip label={_t("common|verified")} side="right">
<VerifiedIcon
width="16px"
height="16px"
className="mx_Verified"
className="mx_RoomHeader_icon mx_Verified"
aria-label={_t("common|verified")}
/>
</Tooltip>
)}

{isDirectMessage && e2eStatus === E2EStatus.Warning && (
<Tooltip label={_t("room|header_untrusted_label")}>
<Tooltip label={_t("room|header_untrusted_label")} side="right">
<ErrorIcon
width="16px"
height="16px"
className="mx_Untrusted"
className="mx_RoomHeader_icon mx_Untrusted"
aria-label={_t("room|header_untrusted_label")}
/>
</Tooltip>
)}
</BodyText>
{roomTopic && (
<BodyText as="div" size="sm" className="mx_RoomHeader_topic">
<BodyText as="div" size="sm" className="mx_RoomHeader_topic mx_RoomHeader_truncated">
<Linkify>{roomTopicBody}</Linkify>
</BodyText>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,24 @@
exports[`<FacePile /> renders with a tooltip 1`] = `
<DocumentFragment>
<div
class="mx_FacePile"
class="mx_AccessibleButton mx_FacePile mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
data-state="closed"
role="button"
tabindex="0"
>
<div
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
role="button"
tabindex="0"
class="_stacked-avatars_ylj7w_116"
>
<div
class="_stacked-avatars_ylj7w_116"
<span
class="_avatar_ylj7w_17 mx_BaseAvatar _avatar-imageless_ylj7w_56"
data-color="8"
data-testid="avatar-img"
data-type="round"
role="presentation"
style="--cpd-avatar-size: 36px;"
>
<span
class="_avatar_ylj7w_17 mx_BaseAvatar _avatar-imageless_ylj7w_56"
data-color="8"
data-testid="avatar-img"
data-type="round"
role="presentation"
style="--cpd-avatar-size: 36px;"
>
4
</span>
</div>
4
</span>
</div>
</div>
</DocumentFragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,24 @@
exports[`<RoomFacePile /> renders 1`] = `
<DocumentFragment>
<div
class="mx_FacePile"
class="mx_AccessibleButton mx_FacePile mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
data-state="closed"
role="button"
tabindex="0"
>
<div
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
role="button"
tabindex="0"
class="_stacked-avatars_ylj7w_116"
>
<div
class="_stacked-avatars_ylj7w_116"
<span
class="_avatar_ylj7w_17 mx_BaseAvatar _avatar-imageless_ylj7w_56"
data-color="8"
data-testid="avatar-img"
data-type="round"
role="presentation"
style="--cpd-avatar-size: 28px;"
>
<span
class="_avatar_ylj7w_17 mx_BaseAvatar _avatar-imageless_ylj7w_56"
data-color="8"
data-testid="avatar-img"
data-type="round"
role="presentation"
style="--cpd-avatar-size: 28px;"
>
b
</span>
</div>
b
</span>
</div>
</div>
</DocumentFragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ exports[`RoomHeader does not show the face pile for DMs 1`] = `
class="_font-body-lg-semibold_1jx6b_83 mx_RoomHeader_heading"
dir="auto"
role="heading"
title="!1:example.org"
>
!1:example.org
<span
class="mx_RoomHeader_truncated"
>
!1:example.org
</span>
</div>
</div>
<nav
Expand Down
Loading