aboutsummaryrefslogtreecommitdiff
path: root/src/components/configuration/inputWrapper.tsx
blob: 0d3fd9568accfb254f8f3040d9509524622b00f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import ConfigType from '../../../common/types/configType'

type InputProps = {
  title: string
  alt?: string
  keyName: keyof ConfigType
  value: string
  placeholder: string
  disabled?: boolean
  handleChange: (value: any, key: keyof ConfigType) => void
}

const InputWrapper = ({
  title,
  alt,
  keyName,
  value,
  placeholder,
  disabled,
  handleChange
}: InputProps) => {
  return (
    <div className="form-control w-full" style={{ display: 'none' }}>
      <label className="label">
        <span className="label-text">{title}</span>
        {alt && <span className="label-text-alt">{alt}</span>}
      </label>
      <input
        className="input input-bordered w-full input-sm"
        type="text"
        value={value || ''}
        disabled={!!disabled}
        placeholder={placeholder}
        onChange={(e) => {
          handleChange({ val: e.target.value, required: true }, keyName)
        }}
      />
    </div>
  )
}
export default InputWrapper