feat: follow mode (#6848)

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
Barnabás Molnár
2023-12-15 00:07:11 +01:00
committed by GitHub
co-authored by dwelle
parent 88a2b286c7
commit aad8ab0123
28 changed files with 1039 additions and 138 deletions
+14 -2
View File
@@ -2,21 +2,33 @@ import "./Avatar.scss";
import React, { useState } from "react";
import { getNameInitial } from "../clients";
import clsx from "clsx";
type AvatarProps = {
onClick: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
color: string;
name: string;
src?: string;
isBeingFollowed?: boolean;
};
export const Avatar = ({ color, onClick, name, src }: AvatarProps) => {
export const Avatar = ({
color,
onClick,
name,
src,
isBeingFollowed,
}: AvatarProps) => {
const shortName = getNameInitial(name);
const [error, setError] = useState(false);
const loadImg = !error && src;
const style = loadImg ? undefined : { background: color };
return (
<div className="Avatar" style={style} onClick={onClick}>
<div
className={clsx("Avatar", { "Avatar--is-followed": isBeingFollowed })}
style={style}
onClick={onClick}
>
{loadImg ? (
<img
className="Avatar-img"