Files
edx-platform/lms/static/js/demographics_collection/SelectWithInput.jsx
Syed Ali Abbas Zaidi 5549db4d80 fix: migrate remaining eslint-config-edx (#31760)
* fix: migrate remaining eslint-config-edx

* refactor: updated eslint rules according to eslint-config-edx-es5

* refactor: add custom rules to suppress unnecessary eslint issues

* refactor: add custom rules to internal eslint configs

* fix: fix all indentation issues

* chore: update lock file
2023-03-02 16:16:50 +05:00

51 lines
1.2 KiB
JavaScript

import React from 'react';
export const SelectWithInput = (props) => {
const {
selectName,
selectId,
selectValue,
options,
inputName,
inputId,
inputType,
inputValue,
selectOnChange,
inputOnChange,
showInput,
inputOnBlur,
labelText,
disabled,
} = props;
return (
<div className="d-flex flex-column pb-3">
<label htmlFor={selectName}>{labelText}</label>
<select
autoFocus
className="form-control"
name={selectName}
id={selectId}
onChange={selectOnChange}
value={selectValue}
disabled={disabled}
>
{options}
</select>
{showInput &&
<input
className="form-control"
aria-label={`${selectName} description field`}
type={inputType}
name={inputName}
id={inputId}
onChange={inputOnChange}
onBlur={inputOnBlur}
value={inputValue}
disabled={disabled}
maxLength={255}
/>
}
</div>
)
}