Skip to content

A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.

983 B
Raw Blame
import { FocusEvent, ReactNode } from 'react'
import TextInputField from '../TextInputField'
import SvgButton from '../SvgButton'

interface TextInputWithIconFieldProps {
  htmlId: string
  value: string
  onChange: (newValue: string) => void
  icon: JSX.Element
  onIconClick: () => void
  afterInput?: ReactNode
  label?: string
  info?: ReactNode
  placeholder?: string
  disabled?: boolean
  extraClass?: string
  onBlur?: (event: FocusEvent<HTMLInputElement>) => void
  onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void
}

const TextInputWithIconField = ({
  icon,
  onIconClick,
  disabled = false,
  ...props
}: TextInputWithIconFieldProps) => {
  return (
    <TextInputField
      {...props}
      disabled={disabled}
      inputIcon={
        <SvgButton
          disabled={disabled}
          onClick={onIconClick}
          className="inputIcon"
        >
          {icon}
        </SvgButton>
      }
    />
  )
}

export default TextInputWithIconField