Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2081 | Rev 2084 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
2073 stevensc 1
import React from 'react'
2080 stevensc 2
import {
3
  FormControl,
4
  InputAdornment,
5
  InputBase,
6
  InputLabel,
7
  styled
8
} from '@mui/material'
9
import FormErrorFeedback from '../form/FormErrorFeedback'
2073 stevensc 10
 
2078 stevensc 11
const AppInput = styled(InputBase)(({ theme }) => ({
2077 stevensc 12
  '& .MuiInputBase-input': {
13
    borderRadius: 4,
14
    position: 'relative',
15
    backgroundColor: theme.palette.background.default,
16
    border: `1px solid var(--border-primary)`,
17
    fontSize: 14,
18
    padding: '5px 10px',
19
    transition: theme.transitions.create([
20
      'border-color',
21
      'background-color',
22
      'box-shadow'
23
    ])
2073 stevensc 24
  },
25
  '& svg': {
26
    fontSize: '1.3rem'
27
  }
28
}))
29
 
2080 stevensc 30
const Input = ({
2081 stevensc 31
  label,
32
  inputRef,
33
  name,
34
  value,
35
  placeholder,
36
  accept,
2082 stevensc 37
  id,
38
  className,
2080 stevensc 39
  error = null,
40
  onChange = () => {},
41
  type = 'text',
2081 stevensc 42
  icon: Icon = null
2080 stevensc 43
}) => {
2077 stevensc 44
  return (
2079 stevensc 45
    <FormControl variant='standard' fullWidth>
2078 stevensc 46
      <InputLabel shrink>{label}</InputLabel>
2080 stevensc 47
      <AppInput
48
        id={id}
49
        className={className}
50
        name={name}
51
        onChange={onChange}
52
        value={value}
53
        type={type}
54
        placeholder={placeholder}
55
        inputRef={inputRef}
56
        accept={accept}
57
        startAdornment={
58
          Icon ? (
59
            <InputAdornment>
60
              <Icon />
61
            </InputAdornment>
62
          ) : null
63
        }
64
        fullWidth
65
      />
66
      {error ? <FormErrorFeedback>{error}</FormErrorFeedback> : null}
2078 stevensc 67
    </FormControl>
2077 stevensc 68
  )
2073 stevensc 69
}
70
 
71
export default Input