Proyectos de Subversion LeadersLinked - SPA

Rev

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