Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2085 | Rev 2705 | 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>
2099 stevensc 49
 
2080 stevensc 50
      <AppInput
51
        id={id}
52
        className={className}
53
        name={name}
54
        onChange={onChange}
55
        value={value}
56
        type={type}
57
        placeholder={placeholder}
58
        inputRef={inputRef}
2099 stevensc 59
        inputProps={{
60
          accept
61
        }}
2080 stevensc 62
        startAdornment={
63
          Icon ? (
64
            <InputAdornment>
65
              <Icon />
66
            </InputAdornment>
67
          ) : null
68
        }
69
        fullWidth
70
      />
2099 stevensc 71
 
2080 stevensc 72
      {error ? <FormErrorFeedback>{error}</FormErrorFeedback> : null}
2078 stevensc 73
    </FormControl>
2077 stevensc 74
  )
2073 stevensc 75
}
76
 
77
export default Input