Improve composer visiblity (#8578)

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Germain 2022-06-07 08:28:29 +01:00 committed by GitHub
parent 8c13a0f8d4
commit f14374a51c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 323 additions and 174 deletions

View file

@ -28,9 +28,14 @@ interface IProps {
onClick?(): void;
colored?: boolean;
emphasizeDisplayName?: boolean;
as?: string;
}
export default class DisambiguatedProfile extends React.Component<IProps> {
public static defaultProps = {
as: "div",
};
render() {
const { fallbackName, member, colored, emphasizeDisplayName, onClick } = this.props;
const rawDisplayName = member?.rawDisplayName || fallbackName;
@ -57,13 +62,14 @@ export default class DisambiguatedProfile extends React.Component<IProps> {
[colorClass]: true,
});
return (
<div className="mx_DisambiguatedProfile" onClick={onClick}>
<span className={displayNameClasses} dir="auto">
{ rawDisplayName }
</span>
{ mxidElement }
</div>
);
return React.createElement(this.props.as, {
className: "mx_DisambiguatedProfile",
onClick,
}, <>
<span className={displayNameClasses} dir="auto">
{ rawDisplayName }
</span>
{ mxidElement }
</>);
}
}

View file

@ -27,12 +27,17 @@ import { MatrixClientPeg } from "../../../MatrixClientPeg";
interface IProps {
mxEvent: MatrixEvent;
onClick?(): void;
as?: string;
}
export default class SenderProfile extends React.PureComponent<IProps> {
public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>;
public static defaultProps = {
as: "div",
};
render() {
const { mxEvent, onClick } = this.props;
const msgtype = mxEvent.getContent().msgtype;
@ -60,6 +65,7 @@ export default class SenderProfile extends React.PureComponent<IProps> {
member={member}
colored={true}
emphasizeDisplayName={true}
as={this.props.as}
/>
);
} }