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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user