Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2705 | Rev 2766 | 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
 
2713 stevensc 11
export 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',
2705 stevensc 44
  icon: Icon = null,
45
  disabled
2080 stevensc 46
}) => {
2077 stevensc 47
  return (
2079 stevensc 48
    <FormControl variant='standard' fullWidth>
2078 stevensc 49
      <InputLabel shrink>{label}</InputLabel>
2099 stevensc 50
 
2080 stevensc 51
      <AppInput
52
        id={id}
53
        className={className}
54
        name={name}
55
        onChange={onChange}
56
        value={value}
57
        type={type}
58
        placeholder={placeholder}
2705 stevensc 59
        disabled={disabled}
2080 stevensc 60
        inputRef={inputRef}
2099 stevensc 61
        inputProps={{
62
          accept
63
        }}
2080 stevensc 64
        startAdornment={
65
          Icon ? (
66
            <InputAdornment>
67
              <Icon />
68
            </InputAdornment>
69
          ) : null
70
        }
71
        fullWidth
72
      />
2099 stevensc 73
 
2080 stevensc 74
      {error ? <FormErrorFeedback>{error}</FormErrorFeedback> : null}
2078 stevensc 75
    </FormControl>
2077 stevensc 76
  )
2073 stevensc 77
}
78
 
79
export default Input