1
0
mirror of https://github.com/Infisical/infisical.git synced 2025-03-29 22:02:57 +00:00

refactor: call modify fns with id instead of index

This commit is contained in:
lemmy mwaura
2022-12-11 17:00:25 +03:00
parent c2f5f19f55
commit b3a50d657d

@ -7,8 +7,8 @@ import guidGenerator from "../utilities/randomId";
const REGEX = /([$]{.*?})/g; const REGEX = /([$]{.*?})/g;
interface DashboardInputFieldProps { interface DashboardInputFieldProps {
index: number; id: string;
onChangeHandler: (value: string, index: number) => void; onChangeHandler: (value: string, id: string) => void;
value: string; value: string;
type: "varName" | "value"; type: "varName" | "value";
blurred: boolean; blurred: boolean;
@ -18,7 +18,7 @@ interface DashboardInputFieldProps {
/** /**
* This component renders the input fields on the dashboard * This component renders the input fields on the dashboard
* @param {object} obj - the order number of a keyPair * @param {object} obj - the order number of a keyPair
* @param {number} obj.index - the order number of a keyPair * @param {string} obj.id - the order number of a keyPair
* @param {function} obj.onChangeHandler - what happens when the input is modified * @param {function} obj.onChangeHandler - what happens when the input is modified
* @param {string} obj.type - whether the input field is for a Key Name or for a Key Value * @param {string} obj.type - whether the input field is for a Key Name or for a Key Value
* @param {string} obj.value - value of the InputField * @param {string} obj.value - value of the InputField
@ -28,7 +28,7 @@ interface DashboardInputFieldProps {
*/ */
const DashboardInputField = ({ const DashboardInputField = ({
index, id,
onChangeHandler, onChangeHandler,
type, type,
value, value,
@ -57,7 +57,7 @@ const DashboardInputField = ({
> >
<input <input
onChange={(e) => onChange={(e) =>
onChangeHandler(e.target.value.toUpperCase(), index) onChangeHandler(e.target.value.toUpperCase(), id)
} }
type={type} type={type}
value={value} value={value}
@ -87,7 +87,7 @@ const DashboardInputField = ({
> >
<input <input
value={value} value={value}
onChange={(e) => onChangeHandler(e.target.value, index)} onChange={(e) => onChangeHandler(e.target.value, id)}
onScroll={syncScroll} onScroll={syncScroll}
className={`${ className={`${
blurred blurred