pull/21833/head
Jorik Schellekens 2020-07-07 15:18:10 +01:00
parent 0d6e7759d0
commit 8458572032
2 changed files with 14 additions and 6 deletions

View File

@ -18,6 +18,7 @@ limitations under the License.
*/ */
import React, {useCallback, useContext, useEffect, useMemo, useState} from 'react'; import React, {useCallback, useContext, useEffect, useMemo, useState} from 'react';
import classNames from 'classnames';
import * as AvatarLogic from '../../../Avatar'; import * as AvatarLogic from '../../../Avatar';
import SettingsStore from "../../../settings/SettingsStore"; import SettingsStore from "../../../settings/SettingsStore";
import AccessibleButton from '../elements/AccessibleButton'; import AccessibleButton from '../elements/AccessibleButton';
@ -38,6 +39,7 @@ interface IProps {
defaultToInitialLetter?: boolean; // true to add default url defaultToInitialLetter?: boolean; // true to add default url
onClick?: React.MouseEventHandler; onClick?: React.MouseEventHandler;
inputRef?: React.RefObject<HTMLImageElement & HTMLSpanElement>; inputRef?: React.RefObject<HTMLImageElement & HTMLSpanElement>;
className?: string;
} }
const useImageUrl = ({url, urls}): [string, () => void] => { const useImageUrl = ({url, urls}): [string, () => void] => {
@ -106,7 +108,7 @@ const BaseAvatar = (props: IProps) => {
const initialLetter = AvatarLogic.getInitialLetter(name); const initialLetter = AvatarLogic.getInitialLetter(name);
const textNode = ( const textNode = (
<span <span
className="mx_BaseAvatar_initial" className={classNames("mx_BaseAvatar_initial", props.className)}
aria-hidden="true" aria-hidden="true"
style={{ style={{
fontSize: toPx(width * 0.65), fontSize: toPx(width * 0.65),
@ -119,7 +121,7 @@ const BaseAvatar = (props: IProps) => {
); );
const imgNode = ( const imgNode = (
<img <img
className="mx_BaseAvatar_image" className={classNames("mx_BaseAvatar_image", props.className)}
src={AvatarLogic.defaultAvatarUrlForString(idName || name)} src={AvatarLogic.defaultAvatarUrlForString(idName || name)}
alt="" alt=""
title={title} title={title}
@ -136,7 +138,7 @@ const BaseAvatar = (props: IProps) => {
<AccessibleButton <AccessibleButton
{...otherProps} {...otherProps}
element="span" element="span"
className="mx_BaseAvatar" className={classNames("mx_BaseAvatar", props.className)}
onClick={onClick} onClick={onClick}
inputRef={inputRef} inputRef={inputRef}
> >
@ -146,7 +148,12 @@ const BaseAvatar = (props: IProps) => {
); );
} else { } else {
return ( return (
<span className="mx_BaseAvatar" ref={inputRef} {...otherProps} role="presentation"> <span
className={classNames("mx_BaseAvatar", props.className)}
ref={inputRef}
{...otherProps}
role="presentation"
>
{ textNode } { textNode }
{ imgNode } { imgNode }
</span> </span>
@ -157,7 +164,7 @@ const BaseAvatar = (props: IProps) => {
if (onClick != null) { if (onClick != null) {
return ( return (
<AccessibleButton <AccessibleButton
className="mx_BaseAvatar mx_BaseAvatar_image" className={classNames("mx_BaseAvatar mx_BaseAvatar_image", props.className)}
element='img' element='img'
src={imageUrl} src={imageUrl}
onClick={onClick} onClick={onClick}
@ -173,7 +180,7 @@ const BaseAvatar = (props: IProps) => {
} else { } else {
return ( return (
<img <img
className="mx_BaseAvatar mx_BaseAvatar_image" className={classNames("mx_BaseAvatar", "mx_BaseAvatar_image", props.className)}
src={imageUrl} src={imageUrl}
onError={onError} onError={onError}
style={{ style={{

View File

@ -63,6 +63,7 @@ interface IState {
export default class CallView extends React.Component<IProps, IState> { export default class CallView extends React.Component<IProps, IState> {
private videoref: React.RefObject<any>; private videoref: React.RefObject<any>;
private dispatcherRef: string; private dispatcherRef: string;
public call: any;
constructor(props: IProps) { constructor(props: IProps) {
super(props); super(props);