Skip to content

Commit

Permalink
Merge pull request #699 from PolicyEngine/inputfield-update-fix
Browse files Browse the repository at this point in the history
Fix input field bug
  • Loading branch information
nikhilwoodruff authored Aug 15, 2023
2 parents 6a7bc5d + efae240 commit b2b3c4d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/controls/InputField.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import { motion } from "framer-motion";
import useMobile from "../layout/Responsive";
import style from "../style";
import { useRef, useState } from "react";
import { useState } from "react";

export default function InputField(props) {
const { onChange, padding, width, type, inputmode, pattern, value } = props;
const {
onChange,
padding,
width,
type,
inputmode,
pattern,
value,
placeholder,
} = props;
const [inputValue, setInputValue] = useState(value ? value : "");
const placeholder = useRef(props.placeholder);
const mobile = useMobile();
const re = /^[0-9\b]*[.]?[0-9\b]*?$/;
const onInput = (e) => {
Expand Down Expand Up @@ -68,7 +76,7 @@ export default function InputField(props) {
setInputValue(e.target.value);
}}
value={inputValue}
placeholder={placeholder.current}
placeholder={placeholder}
/>
);
}
2 changes: 1 addition & 1 deletion src/pages/policy/input/ParameterEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default function ParameterEditor(props) {
<CenteredMiddleColumn
marginTop="5%"
marginBottom={0}
title={capitalize(parameter.label)}
title={capitalize(parameter.label.toLowerCase())}
description={description + timePeriodSentence}
>
{editControl}
Expand Down

0 comments on commit b2b3c4d

Please sign in to comment.