Skip to content

Commit 538c668

Browse files
Merge branch 'main' into feat/2024updates
2 parents e85aeb4 + 603cf43 commit 538c668

File tree

3 files changed

+325
-325
lines changed

3 files changed

+325
-325
lines changed

src/components/Scout.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ const Scout = () => {
175175
<>
176176
<Toggle prop="scoreTrap" phase label="Score Trap" trueLabel = "Scored Trap" color="green" width="fiveTwelfths" height="twoHigh"></Toggle>
177177
<Toggle prop="harmonize" phase label="Harmonize" trueLabel = "Harmonized" color="yellow" width={"fiveTwelfths"} height="twoHigh"></Toggle>
178-
<Toggle prop="park" phase label="Park" trueLabel = "Parked" color="purple" width={"fiveTwelfths"} height="twoHigh"></Toggle>
179-
<Numbers label="Climb Time of start (secs)" idealLength = {2} prop="climbTimeOfStart" width = "fiveTwelfths" twoLines={false} height = "twoHigh"></Numbers>
178+
<Toggle prop="park" phase label="Park" trueLabel = "Parked" color="purple" width={"fiveTwelfths"} height="twoHigh"></Toggle>
179+
<Numbers label="Climb Time of start (secs)" phase idealLength = {2} prop="climbTimeOfStart" width = "fiveTwelfths" twoLines={false} height = "twoHigh"></Numbers>
180180
<Undo width = "fiveTwelfths" height = "twoHigh"></Undo>
181181

182182
<Next width ="fiveTwelfths" height = "twoHigh"></Next>

src/components/inputs/Numbers.jsx

+53-53
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
1-
import React, { useContext } from "react"
2-
import { Context } from "../../state"
3-
import PropTypes from "prop-types"
4-
5-
import "./inputs.scss"
6-
7-
const Numbers = ({ label, prop, idealLength = 4, width, twoLines, height }) => {
8-
9-
const [state, dispatch] = useContext(Context)
10-
const id = `Numbers-${label}-${prop}`.replaceAll(" ", "_")
11-
12-
const numberInputComponent = <>
13-
<label htmlFor={id} className={`${twoLines ? "default" : ""}`}>
14-
{label}
15-
</label>
16-
<input
17-
id={id}
18-
type="number"
19-
pattern="[0-9]*"
20-
placeholder={"0".repeat(idealLength)}
21-
autoComplete="off"
22-
className={`${width ? width : "wide"}`}
23-
onChange={(event) => {
24-
dispatch({
25-
type: "set",
26-
prop,
27-
val: !(
28-
event.target.value === undefined || event.target.value === ""
29-
)
30-
? parseInt(event.target.value)
31-
: undefined,
32-
})
33-
}}
34-
value={state[prop] ?? ""}
35-
/>
36-
</>
37-
38-
return twoLines ? numberInputComponent : (
39-
<div className={`Numbers ${ width ? width :"wide"} ${height}`}>
40-
{numberInputComponent}
41-
</div>
42-
)
43-
}
44-
45-
Numbers.propTypes = {
46-
label: PropTypes.string.isRequired,
47-
prop: PropTypes.string.isRequired,
48-
idealLength: PropTypes.number,
49-
width: PropTypes.string,
50-
twoLines: PropTypes.bool,
51-
}
52-
53-
export default Numbers
1+
import React, { useContext } from "react"
2+
import { Context } from "../../state"
3+
import PropTypes from "prop-types"
4+
5+
import "./inputs.scss"
6+
7+
const Numbers = ({ label, prop, phase, idealLength = 4, width, twoLines, height }) => {
8+
9+
const [state, dispatch] = useContext(Context)
10+
const id = `Numbers-${label}-${prop}`.replaceAll(" ", "_")
11+
12+
const numberInputComponent = <>
13+
<label htmlFor={id} className={`${twoLines ? "default" : ""}`}>
14+
{label}
15+
</label>
16+
<input
17+
id={id}
18+
type="number"
19+
pattern="[0-9]*"
20+
placeholder={"0".repeat(idealLength)}
21+
autoComplete="off"
22+
className={`${width ? width : "wide"}`}
23+
onChange={(event) => {
24+
dispatch({
25+
type: `set${phase ? "InPhase" : ""}`,
26+
prop,
27+
val: !(
28+
event.target.value === undefined || event.target.value === ""
29+
)
30+
? parseInt(event.target.value)
31+
: undefined,
32+
})
33+
}}
34+
value={state[prop] ?? ""}
35+
/>
36+
</>
37+
38+
return twoLines ? numberInputComponent : (
39+
<div className={`Numbers ${ width ? width :"wide"} ${height}`}>
40+
{numberInputComponent}
41+
</div>
42+
)
43+
}
44+
45+
Numbers.propTypes = {
46+
label: PropTypes.string.isRequired,
47+
prop: PropTypes.string.isRequired,
48+
idealLength: PropTypes.number,
49+
width: PropTypes.string,
50+
twoLines: PropTypes.bool,
51+
}
52+
53+
export default Numbers

0 commit comments

Comments
 (0)