Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2073 | Rev 2078 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

import React from 'react'
import { InputAdornment, TextField, styled } from '@mui/material'

const AppInput = styled(TextField)(({ theme }) => ({
  '& .MuiInputBase-input': {
    borderRadius: 4,
    position: 'relative',
    backgroundColor: theme.palette.background.default,
    border: `1px solid var(--border-primary)`,
    fontSize: 14,
    padding: '5px 10px',
    transition: theme.transitions.create([
      'border-color',
      'background-color',
      'box-shadow'
    ])
  },
  '& svg': {
    fontSize: '1.3rem'
  }
}))

const Input = ({
  label = '',
  inputRef = null,
  icon: Icon = null,
  error = null,
  name = '',
  onChange = () => {},
  value = '',
  type = 'text',
  placeholder = '',
  accept = ''
}) => {
  return (
    <AppInput
      label={label}
      helperText={error}
      error={Boolean(error)}
      ref={inputRef}
      id={name}
      name={name}
      fullWidth
      placeholder={placeholder}
      onChange={onChange}
      value={value}
      InputProps={{
        startAdornment: Icon ? (
          <InputAdornment position='start'>
            <Icon />
          </InputAdornment>
        ) : null
      }}
      inputProps={{
        accept
      }}
      type={type}
    />
  )
}

export default Input