Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2080 | Rev 2082 | 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,
2080 stevensc 37
  error = null,
38
  onChange = () => {},
39
  type = 'text',
2081 stevensc 40
  icon: Icon = null
2080 stevensc 41
}) => {
2077 stevensc 42
  return (
2079 stevensc 43
    <FormControl variant='standard' fullWidth>
2078 stevensc 44
      <InputLabel shrink>{label}</InputLabel>
2080 stevensc 45
      <AppInput
46
        id={id}
47
        className={className}
48
        name={name}
49
        onChange={onChange}
50
        value={value}
51
        type={type}
52
        placeholder={placeholder}
53
        inputRef={inputRef}
54
        accept={accept}
55
        startAdornment={
56
          Icon ? (
57
            <InputAdornment>
58
              <Icon />
59
            </InputAdornment>
60
          ) : null
61
        }
62
        fullWidth
63
      />
64
      {error ? <FormErrorFeedback>{error}</FormErrorFeedback> : null}
2078 stevensc 65
    </FormControl>
2077 stevensc 66
  )
2073 stevensc 67
}
68
 
69
export default Input