23 lines
606 B
JavaScript
23 lines
606 B
JavaScript
import React from "react";
|
|
import nextId from "react-id-generator";
|
|
import s from "./MyInput.module.scss";
|
|
|
|
const MyInput = ({ label, value, noActiveBorder, isValid, ...props }) => {
|
|
const id = nextId();
|
|
const inputClasses = isValid && !noActiveBorder > 0 ? "_input-filled" : "";
|
|
|
|
return (
|
|
<div className={s.myInput}>
|
|
{label && (
|
|
<label className={s.label} htmlFor={id}>
|
|
{label}
|
|
</label>
|
|
)}
|
|
<div className={s.myInput}>
|
|
<input className={inputClasses} id={id} value={value} {...props} />
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default MyInput;
|