Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2082 | Rev 2085 | 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': {
2084 stevensc 24
    padding: 0
2073 stevensc 25
  },
26
  '& svg': {
27
    fontSize: '1.3rem'
28
  }
29
}))
30
 
2080 stevensc 31
const Input = ({
2081 stevensc 32
  label,
33
  inputRef,
34
  name,
35
  value,
36
  placeholder,
37
  accept,
2082 stevensc 38
  id,
39
  className,
2080 stevensc 40
  error = null,
41
  onChange = () => {},
42
  type = 'text',
2081 stevensc 43
  icon: Icon = null
2080 stevensc 44
}) => {
2077 stevensc 45
  return (
2079 stevensc 46
    <FormControl variant='standard' fullWidth>
2078 stevensc 47
      <InputLabel shrink>{label}</InputLabel>
2080 stevensc 48
      <AppInput
49
        id={id}
50
        className={className}
51
        name={name}
52
        onChange={onChange}
53
        value={value}
54
        type={type}
55
        placeholder={placeholder}
56
        inputRef={inputRef}
57
        accept={accept}
58
        startAdornment={
59
          Icon ? (
60
            <InputAdornment>
61
              <Icon />
62
            </InputAdornment>
63
          ) : null
64
        }
65
        fullWidth
66
      />
67
      {error ? <FormErrorFeedback>{error}</FormErrorFeedback> : null}
2078 stevensc 68
    </FormControl>
2077 stevensc 69
  )
2073 stevensc 70
}
71
 
72
export default Input