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

Show default CT/T team logo if no custom logo is present

This commit is contained in:
Attila 2023-12-28 17:32:42 +01:00 committed by GitHub
parent 656fce7e4f
commit 68ec8960ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
import { Team } from 'csgogsi'; import { Team } from 'csgogsi';
import * as I from '../../API/types'; import * as I from '../../API/types';
import { apiUrl } from './../../API'; import { apiUrl } from './../../API';
import { LogoCT, LogoT } from './../../assets/Icons';
const TeamLogo = ({team, height, width }: { team?: Team | I.Team | null, height?: number, width?: number}) => { const TeamLogo = ({team, height, width }: { team?: Team | I.Team | null, height?: number, width?: number}) => {
if(!team) return null; if(!team) return null;
@ -13,10 +14,10 @@ const TeamLogo = ({team, height, width }: { team?: Team | I.Team | null, height?
} }
return ( return (
<div className={`logo`}> <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> </div>
); );
} }
export default TeamLogo; export default TeamLogo;