import styles from '../styles/input.module.scss';
import { parseClassName } from '../utils/utils.js';

export default function Input(props) {
  const id = Math.random()
  return (
    <span className={parseClassName([styles["input-container"], props.error ? styles['error']:undefined])}>
      <input {...props} id={`input_${id}`} className={styles.input} required placeholder=''/>
      <label className={styles.label} htmlFor={`input_${id}`}>
        {props.placeholder}
      </label>
      <span className={styles.bar}></span>
    </span>
  );
}