github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/webapp/javascript/ui/InputField/index.tsx (about)

     1  import React, { InputHTMLAttributes, ChangeEvent } from 'react';
     2  import Input from '../Input';
     3  import styles from './InputField.module.css';
     4  
     5  interface IInputFieldProps extends InputHTMLAttributes<HTMLInputElement> {
     6    label: string;
     7    className?: string;
     8    name: string;
     9    placeholder?: string;
    10    type: 'text' | 'password' | 'email' | 'number';
    11    value: string;
    12    onChange: (e: ChangeEvent<HTMLInputElement>) => void;
    13    id?: string;
    14  }
    15  
    16  /**
    17   * @deprecated use TextField instead
    18   */
    19  function InputField({
    20    label,
    21    className,
    22    name,
    23    onChange,
    24    placeholder,
    25    type,
    26    value,
    27    id,
    28  }: IInputFieldProps) {
    29    return (
    30      <div className={`${className || ''} ${styles.inputWrapper}`}>
    31        <label className={styles.label}>{label}</label>
    32        <Input
    33          type={type}
    34          placeholder={placeholder}
    35          name={name}
    36          onChange={onChange}
    37          value={value}
    38          htmlId={id}
    39        />
    40      </div>
    41    );
    42  }
    43  
    44  export default InputField;