Skip to content

Commit f29ce94

Browse files
Style room header icons and facepile for toggled state (#28968)
* Fix tiny typo in existing code * Create a hook that uses the right panel store So that we track changes to the right panel phases * Create a context that wraps the previous hook we created We do this so that we can get by using a single event listener i.e we only need to call `useCurrentPhase` in the provider as opposed to calling it in each header icon. * Create a hook that tells you if a panel is open or not * Create component that wraps Icon and adds a class name when the corresponding panel is open * Style room header icons for when they are toggled * Style face pile for toggle state * Fix broken CI * Give directory a better name * Update year in license * Use a stronger type
1 parent 76485cf commit f29ce94

File tree

16 files changed

+615
-435
lines changed

16 files changed

+615
-435
lines changed

res/css/views/rooms/_RoomHeader.pcss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Please see LICENSE files in the repository root for full details.
7171
padding: var(--cpd-space-1-5x);
7272
cursor: pointer;
7373
user-select: none;
74+
font: var(--cpd-font-body-sm-medium);
7475

7576
/* RoomAvatar doesn't pass classes down to avatar
7677
So set style here
@@ -83,6 +84,12 @@ Please see LICENSE files in the repository root for full details.
8384
color: $primary-content;
8485
background: var(--cpd-color-bg-subtle-primary);
8586
}
87+
88+
&.mx_FacePile_toggled {
89+
background: var(--cpd-color-bg-success-subtle);
90+
color: var(--cpd-color-text-action-accent);
91+
font: var(--cpd-font-body-sm-semibold);
92+
}
8693
}
8794

8895
.mx_RoomHeader .mx_BaseAvatar {
@@ -93,3 +100,7 @@ Please see LICENSE files in the repository root for full details.
93100
/* Workaround for https://github.com/element-hq/compound/issues/331 */
94101
min-width: 240px;
95102
}
103+
104+
.mx_RoomHeader .mx_RoomHeader_toggled {
105+
color: var(--cpd-color-icon-accent-primary);
106+
}

src/components/structures/RoomView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ import RoomPreviewBar from "../views/rooms/RoomPreviewBar";
6666
import RoomPreviewCard from "../views/rooms/RoomPreviewCard";
6767
import RoomUpgradeWarningBar from "../views/rooms/RoomUpgradeWarningBar";
6868
import AuxPanel from "../views/rooms/AuxPanel";
69-
import RoomHeader from "../views/rooms/RoomHeader";
69+
import RoomHeader from "../views/rooms/RoomHeader/RoomHeader";
7070
import { IOOBData, IThreepidInvite } from "../../stores/ThreepidInviteStore";
7171
import EffectsOverlay from "../views/elements/EffectsOverlay";
7272
import { containsEmoji } from "../../effects/utils";

src/components/structures/WaitingForThirdPartyRoomView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/matrix";
1111

1212
import ResizeNotifier from "../../utils/ResizeNotifier";
1313
import ErrorBoundary from "../views/elements/ErrorBoundary";
14-
import RoomHeader from "../views/rooms/RoomHeader";
14+
import RoomHeader from "../views/rooms/RoomHeader/RoomHeader.tsx";
1515
import ScrollPanel from "./ScrollPanel";
1616
import EventTileBubble from "../views/messages/EventTileBubble";
1717
import NewRoomIntro from "../views/rooms/NewRoomIntro";

src/components/views/elements/FacePile.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ Please see LICENSE files in the repository root for full details.
99
import React, { FC, HTMLAttributes, ReactNode } from "react";
1010
import { RoomMember } from "matrix-js-sdk/src/matrix";
1111
import { AvatarStack, Tooltip } from "@vector-im/compound-web";
12+
import classNames from "classnames";
1213

1314
import MemberAvatar from "../avatars/MemberAvatar";
1415
import AccessibleButton, { ButtonEvent } from "./AccessibleButton";
16+
import { useToggled } from "../rooms/RoomHeader/toggle/useToggled";
17+
import { RightPanelPhases } from "../../../stores/right-panel/RightPanelStorePhases";
1518

1619
interface IProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
1720
members: RoomMember[];
@@ -57,8 +60,14 @@ const FacePile: FC<IProps> = ({
5760
</>
5861
);
5962

63+
const toggled = useToggled(RightPanelPhases.MemberList);
64+
const classes = classNames({
65+
mx_FacePile: true,
66+
mx_FacePile_toggled: toggled,
67+
});
68+
6069
const content = (
61-
<AccessibleButton {...props} className="mx_FacePile" onClick={onClick ?? null}>
70+
<AccessibleButton {...props} className={classes} onClick={onClick ?? null}>
6271
<AvatarStack>{pileContents}</AvatarStack>
6372
{children}
6473
</AccessibleButton>

0 commit comments

Comments
 (0)