mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-02-11 06:24:56 -05:00
24 lines
594 B
TypeScript
24 lines
594 B
TypeScript
import { Avatar, AvatarProps } from '@metafam/ds';
|
|
import { PlayerFragmentFragment } from 'graphql/autogen/types';
|
|
import React from 'react';
|
|
import {
|
|
getPlayerImage,
|
|
getPlayerName,
|
|
hasPlayerImage,
|
|
} from 'utils/playerHelpers';
|
|
|
|
type PlayerAvatarProps = AvatarProps & { player: PlayerFragmentFragment };
|
|
export const PlayerAvatar: React.FC<PlayerAvatarProps> = ({
|
|
player,
|
|
...props
|
|
}) => {
|
|
const attrs = {
|
|
src: getPlayerImage(player),
|
|
name: getPlayerName(player),
|
|
...props,
|
|
};
|
|
if (hasPlayerImage(player)) attrs.bg = 'transparent';
|
|
|
|
return <Avatar {...attrs} />;
|
|
};
|