Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2073 | Rev 2078 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 2073 Rev 2077
Línea 1... Línea 1...
1
import React from 'react'
1
import React from 'react'
2
import { InputBase, styled } from '@mui/material'
2
import { InputAdornment, TextField, styled } from '@mui/material'
Línea 3... Línea 3...
3
 
3
 
-
 
4
const AppInput = styled(TextField)(({ theme }) => ({
4
const AppInput = styled(InputBase)(({ theme }) => ({
5
  '& .MuiInputBase-input': {
5
  borderRadius: 4,
6
    borderRadius: 4,
6
  position: 'relative',
7
    position: 'relative',
7
  backgroundColor: theme.palette.background.default,
8
    backgroundColor: theme.palette.background.default,
8
  border: `1px solid var(--border-primary)`,
9
    border: `1px solid var(--border-primary)`,
9
  fontSize: 14,
10
    fontSize: 14,
10
  padding: '10px 12px',
-
 
11
  marginBottom: theme.spacing(1),
11
    padding: '5px 10px',
12
  transition: theme.transitions.create([
12
    transition: theme.transitions.create([
13
    'border-color',
13
      'border-color',
14
    'background-color',
14
      'background-color',
15
    'box-shadow'
15
      'box-shadow'
16
  ]),
-
 
17
  '& + p': {
-
 
18
    marginBottom: theme.spacing(1)
-
 
19
  },
-
 
20
  'p + &': {
-
 
21
    marginBottom: theme.spacing(0)
16
    ])
22
  },
17
  },
23
  '& svg': {
18
  '& svg': {
24
    fontSize: '1.3rem'
-
 
25
  },
-
 
26
  '& .MuiInputBase-input': {
-
 
27
    padding: 0
19
    fontSize: '1.3rem'
28
  }
20
  }
Línea 29... Línea 21...
29
}))
21
}))
-
 
22
 
-
 
23
const Input = ({
-
 
24
  label = '',
-
 
25
  inputRef = null,
-
 
26
  icon: Icon = null,
-
 
27
  error = null,
-
 
28
  name = '',
-
 
29
  onChange = () => {},
-
 
30
  value = '',
-
 
31
  type = 'text',
-
 
32
  placeholder = '',
-
 
33
  accept = ''
-
 
34
}) => {
-
 
35
  return (
-
 
36
    <AppInput
-
 
37
      label={label}
-
 
38
      helperText={error}
-
 
39
      error={Boolean(error)}
-
 
40
      ref={inputRef}
-
 
41
      id={name}
-
 
42
      name={name}
-
 
43
      fullWidth
-
 
44
      placeholder={placeholder}
-
 
45
      onChange={onChange}
-
 
46
      value={value}
-
 
47
      InputProps={{
-
 
48
        startAdornment: Icon ? (
30
 
49
          <InputAdornment position='start'>
-
 
50
            <Icon />
-
 
51
          </InputAdornment>
-
 
52
        ) : null
-
 
53
      }}
-
 
54
      inputProps={{
-
 
55
        accept
-
 
56
      }}
-
 
57
      type={type}
31
const Input = ({ ...props }) => {
58
    />
Línea 32... Línea 59...
32
  return <AppInput {...props} />
59
  )