mirror of
https://github.com/lexogrine/cs2-react-hud.git
synced 2025-12-10 03:52:48 +01:00
25 lines
717 B
TypeScript
25 lines
717 B
TypeScript
import React from 'react';
|
|
import { Team } from 'csgogsi-socket';
|
|
import * as I from '../../api/interfaces';
|
|
import { apiUrl } from './../../api/api';
|
|
|
|
export default class TeamLogo extends React.Component<{ team?: Team | I.Team | null, height?: number, width?: number}> {
|
|
render(){
|
|
const { team } = this.props;
|
|
if(!team) return null;
|
|
let id = '';
|
|
const { logo } = team;
|
|
if('_id' in team){
|
|
id = team._id;
|
|
} else if('id' in team && team.id){
|
|
id = team.id;
|
|
}
|
|
return (
|
|
<div className={`logo`}>
|
|
{ logo && id ? <img src={`${apiUrl}api/teams/logo/${id}`} width={this.props.width} height={this.props.height} alt={'Team logo'} /> : ''}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
}
|