Skip to content

Commit

Permalink
Style face pile for toggle state
Browse files Browse the repository at this point in the history
  • Loading branch information
MidhunSureshR committed Jan 12, 2025
1 parent 14ae321 commit 4eace4f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions res/css/views/rooms/_RoomHeader.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Please see LICENSE files in the repository root for full details.
padding: var(--cpd-space-1-5x);
cursor: pointer;
user-select: none;
font: var(--cpd-font-body-sm-medium);

/* RoomAvatar doesn't pass classes down to avatar
So set style here
Expand All @@ -83,6 +84,12 @@ Please see LICENSE files in the repository root for full details.
color: $primary-content;
background: var(--cpd-color-bg-subtle-primary);
}

&.mx_FacePile_toggled {
background: var(--cpd-color-bg-success-subtle);
color: var(--cpd-color-text-action-accent);
font: var(--cpd-font-body-sm-semibold);
}
}

.mx_RoomHeader .mx_BaseAvatar {
Expand Down
11 changes: 10 additions & 1 deletion src/components/views/elements/FacePile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ Please see LICENSE files in the repository root for full details.
import React, { FC, HTMLAttributes, ReactNode } from "react";
import { RoomMember } from "matrix-js-sdk/src/matrix";
import { AvatarStack, Tooltip } from "@vector-im/compound-web";
import classNames from "classnames";

import MemberAvatar from "../avatars/MemberAvatar";
import AccessibleButton, { ButtonEvent } from "./AccessibleButton";
import { useToggled } from "../rooms/RoomHeader/highlight/useToggled";
import { RightPanelPhases } from "../../../stores/right-panel/RightPanelStorePhases";

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

const toggled = useToggled(RightPanelPhases.MemberList);
const classes = classNames({
mx_FacePile: true,
mx_FacePile_toggled: toggled,
});

const content = (
<AccessibleButton {...props} className="mx_FacePile" onClick={onClick ?? null}>
<AccessibleButton {...props} className={classes} onClick={onClick ?? null}>
<AvatarStack>{pileContents}</AvatarStack>
{children}
</AccessibleButton>
Expand Down

0 comments on commit 4eace4f

Please sign in to comment.