Proyectos de Subversion LeadersLinked - SPA

Rev

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