diff --git a/app/components/Avatar/Avatar.tsx b/app/components/Avatar/Avatar.tsx index 290a298d4..5d26fc8ff 100644 --- a/app/components/Avatar/Avatar.tsx +++ b/app/components/Avatar/Avatar.tsx @@ -1,8 +1,7 @@ -import { observable } from "mobx"; -import { observer } from "mobx-react"; import * as React from "react"; import styled from "styled-components"; import User from "~/models/User"; +import useBoolean from "~/hooks/useBoolean"; import placeholder from "./placeholder.png"; type Props = { @@ -16,35 +15,28 @@ type Props = { className?: string; }; -@observer -class Avatar extends React.Component { - @observable - error: boolean; +function Avatar(props: Props) { + const { src, icon, showBorder, ...rest } = props; - static defaultProps = { - size: 24, - }; + const [error, handleError] = useBoolean(false); - handleError = () => { - this.error = true; - }; - - render() { - const { src, icon, showBorder, ...rest } = this.props; - return ( - - - {icon && {icon}} - - ); - } + return ( + + + {icon && {icon}} + + ); } +Avatar.defaultProps = { + size: 24, +}; + const AvatarWrapper = styled.div` position: relative; `;