1
0
mirror of https://github.com/lexogrine/cs2-react-hud.git synced 2025-12-10 02:42:49 +01:00

Merge pull request #2 from borzaka/patch-1

Show default CT/T team logo if no custom logo is present
This commit is contained in:
Hubert Walczak 2024-04-12 07:53:23 +02:00 committed by GitHub
commit 8ad1a9410b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,7 @@
import { Team } from 'csgogsi';
import * as I from '../../API/types';
import { apiUrl } from './../../API';
import { LogoCT, LogoT } from './../../assets/Icons';
const TeamLogo = ({team, height, width }: { team?: Team | I.Team | null, height?: number, width?: number}) => {
if(!team) return null;
@ -13,10 +14,10 @@ const TeamLogo = ({team, height, width }: { team?: Team | I.Team | null, height?
}
return (
<div className={`logo`}>
{ logo && id ? <img src={`${apiUrl}api/teams/logo/${id}`} width={width} height={height} alt={'Team logo'} /> : ''}
<img src={logo && id ? `${apiUrl}api/teams/logo/${id}` : ('side' in team && team.side === "CT" ? LogoCT : LogoT)} width={width} height={height} alt={'Team logo'} />
</div>
);
}
export default TeamLogo;
export default TeamLogo;