1
0
mirror of https://github.com/lexogrine/cs2-react-hud.git synced 2026-05-04 04:03:10 +02:00

Updated setup to vite and moved to hooks instead of class

This commit is contained in:
Hubert Walczak
2023-11-02 12:11:03 +01:00
parent 44f173f23c
commit f88baa5fc9
90 changed files with 7411 additions and 2706 deletions
+12 -14
View File
@@ -1,15 +1,13 @@
import React from 'react';
import { Player } from 'csgogsi-socket';
import {ArmorHelmet, ArmorFull} from './../../assets/Icons';
export default class Armor extends React.Component<{ player: Player }> {
render() {
const { player } = this.props;
if(!player.state.health || !player.state.armor) return '';
return (
<div className={`armor_indicator`}>
{player.state.helmet ? <ArmorHelmet /> : <ArmorFull/>}
</div>
);
}
import React from "react";
import { ArmorFull, ArmorHelmet } from "./../../assets/Icons";
}
const Armor = ({ health, armor, helmet }: { health: number, armor: number, helmet: boolean }) => {
if (!health || !armor) return null;
return (
<div className={`armor_indicator`}>
{helmet ? <ArmorHelmet /> : <ArmorFull />}
</div>
);
};
export default React.memo(Armor);