mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-02-11 06:24:56 -05:00
25 lines
592 B
TypeScript
25 lines
592 B
TypeScript
import { Avatar, AvatarProps } from '@metafam/ds';
|
|
import React from 'react';
|
|
|
|
import { PlayerFragmentFragment } from '../../graphql/autogen/types';
|
|
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} />;
|
|
};
|