From 1f55158727edbe50cc71d51f3a27e89bbd7b90ff Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Sat, 14 Aug 2021 10:53:53 +0200 Subject: [PATCH] Migrate AvatarSetting to TypeScript --- .../{AvatarSetting.js => AvatarSetting.tsx} | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) rename src/components/views/settings/{AvatarSetting.js => AvatarSetting.tsx} (86%) diff --git a/src/components/views/settings/AvatarSetting.js b/src/components/views/settings/AvatarSetting.tsx similarity index 86% rename from src/components/views/settings/AvatarSetting.js rename to src/components/views/settings/AvatarSetting.tsx index f22c4f1c85..806d0adb73 100644 --- a/src/components/views/settings/AvatarSetting.js +++ b/src/components/views/settings/AvatarSetting.tsx @@ -15,12 +15,19 @@ limitations under the License. */ import React, { useState } from "react"; -import PropTypes from "prop-types"; import { _t } from "../../../languageHandler"; import AccessibleButton from "../elements/AccessibleButton"; import classNames from "classnames"; -const AvatarSetting = ({ avatarUrl, avatarAltText, avatarName, uploadAvatar, removeAvatar }) => { +interface IProps { + avatarUrl?: string; + avatarName: string; // name of user/room the avatar belongs to + uploadAvatar?: (e: React.MouseEvent) => void; + removeAvatar?: (e: React.MouseEvent) => void; + avatarAltText: string; +} + +const AvatarSetting: React.FC = ({ avatarUrl, avatarAltText, avatarName, uploadAvatar, removeAvatar }) => { const [isHovering, setIsHovering] = useState(false); const hoveringProps = { onMouseEnter: () => setIsHovering(true), @@ -78,12 +85,4 @@ const AvatarSetting = ({ avatarUrl, avatarAltText, avatarName, uploadAvatar, rem ; }; -AvatarSetting.propTypes = { - avatarUrl: PropTypes.string, - avatarName: PropTypes.string.isRequired, // name of user/room the avatar belongs to - uploadAvatar: PropTypes.func, - removeAvatar: PropTypes.func, - avatarAltText: PropTypes.string.isRequired, -}; - export default AvatarSetting;