Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 1838 Rev 2104
Línea 7... Línea 7...
7
} from '@mui/material'
7
} from '@mui/material'
Línea 8... Línea 8...
8
 
8
 
Línea 9... Línea 9...
9
import FormErrorFeedback from '../form/FormErrorFeedback'
9
import FormErrorFeedback from '../form/FormErrorFeedback'
10
 
10
 
-
 
11
const Select = ({
-
 
12
  label,
-
 
13
  name,
-
 
14
  value,
11
const Select = ({
15
  placeholder,
12
  label = '',
-
 
13
  options = [],
-
 
14
  inputRef = null,
-
 
15
  name = '',
-
 
16
  value = '',
16
  defaultValue,
-
 
17
  options = [],
17
  onChange = () => {},
18
  error = null,
18
  error = null,
19
  inputRef = null,
19
  placeholder = ''
20
  onChange = () => {}
20
}) => {
21
}) => {
21
  return (
22
  return (
22
    <FormControl fullWidth>
23
    <FormControl fullWidth>
23
      {label ? (
24
      {label ? (
24
        <InputLabel shrink htmlFor={name}>
25
        <InputLabel shrink htmlFor={name}>
25
          {label}
26
          {label}
-
 
27
        </InputLabel>
26
        </InputLabel>
28
      ) : null}
27
      ) : null}
29
 
-
 
30
      <MuiSelect
28
      <MuiSelect
31
        inputRef={inputRef}
29
        ref={inputRef}
32
        defaultValue={defaultValue}
30
        value={value}
33
        value={value}
31
        onChange={onChange}
34
        onChange={onChange}
-
 
35
        name={name}
-
 
36
        id={name}
-
 
37
        sx={{
32
        name={name}
38
          borderRadius: '4px'
33
        id={name}
39
        }}
34
        fullWidth
40
        fullWidth
35
        displayEmpty
41
        displayEmpty
36
      >
42
      >
37
        <MenuItem value=''>{placeholder}</MenuItem>
43
        <MenuItem value=''>{placeholder}</MenuItem>
38
        {options.map(({ name, value }) => (
44
        {options.map(({ name, value }) => (
39
          <MenuItem key={value} value={value}>
45
          <MenuItem key={value} value={value}>
40
            {name}
46
            {name}
41
          </MenuItem>
47
          </MenuItem>
-
 
48
        ))}
42
        ))}
49
      </MuiSelect>
43
      </MuiSelect>
50
 
44
      {error ? <FormErrorFeedback>{error}</FormErrorFeedback> : null}
51
      {error ? <FormErrorFeedback>{error}</FormErrorFeedback> : null}
45
    </FormControl>
52
    </FormControl>