Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wellsousaaa
GitHub Repository: wellsousaaa/Five-Nights-at-Freddys-Web
Path: blob/main/src/components/Hud.js
270 views
1
import React from "react";
2
import { connect } from "react-redux";
3
4
function Hud({ hour, energy }) {
5
return (
6
<div style={{ zIndex: 10 }}>
7
<h1 className="hour">{hour === 0 ? "12AM" : `${hour}AM`}</h1>
8
<h2 className="energy">{energy}%</h2>
9
</div>
10
);
11
}
12
13
const mapStateToProps = (state) => {
14
return {
15
hour: state.configReducer.hour,
16
energy: state.configReducer.energy,
17
};
18
};
19
20
export default connect(mapStateToProps)(Hud);
21
22