import React, { ChangeEvent } from 'react'

export default function Input({
  text,
  name,
  value = '',
  placeholder,
  onchange,
}: {
  text: string
  name: string
  value?: string
  placeholder?: string
  onchange: (name: string, event: ChangeEvent<{ value: string }>) => void
}) {
  return (
    <>
      <label htmlFor={name} className="pb-label">
        {text}
      </label>
      <div className="pb-input_wrapper">
        <input
          type="text"
          name={name}
          className="pb-input"
          placeholder={placeholder}
          value={value}
          onChange={onchange.bind(null, name)}
        />
      </div>
    </>
  )
}
