Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 1782 Rev 1784
Línea 1... Línea 1...
1
import React from 'react'
1
import React from 'react'
2
import {
-
 
3
  FormControl,
-
 
4
  InputLabel,
-
 
5
  MenuItem,
-
 
6
  Select as MuiSelect
-
 
7
} from '@mui/material'
2
import { FormControl, InputLabel, Select as MuiSelect } from '@mui/material'
Línea 8... Línea 3...
8
 
3
 
Línea 9... Línea 4...
9
import FormErrorFeedback from '../form/FormErrorFeedback'
4
import FormErrorFeedback from '../form/FormErrorFeedback'
10
 
5
 
11
const Select = ({
6
const Select = ({
12
  label = '',
7
  label = '',
13
  options = [],
8
  options = [],
14
  inputRef = null,
9
  inputRef = null,
15
  name = '',
10
  name = '',
16
  value,
11
  value = '',
17
  onChange,
12
  onChange = () => {},
18
  error = null
13
  error = null
19
}) => {
14
}) => {
20
  return (
-
 
21
    <FormControl fullWidth>
15
  return (
22
      {label ? (
-
 
23
        <InputLabel shrink htmlFor={name}>
-
 
24
          {label}
-
 
25
        </InputLabel>
16
    <FormControl fullWidth>
26
      ) : null}
17
      {label ? <InputLabel htmlFor={name}>{label}</InputLabel> : null}
27
      <MuiSelect
18
      <MuiSelect
28
        ref={inputRef}
19
        ref={inputRef}
29
        value={value}
20
        value={value}
30
        onChange={onChange}
21
        onChange={onChange}
31
        id={name}
22
        id={name}
32
        fullWidth
23
        fullWidth
33
      >
24
      >
34
        {options.map(({ name, value }) => (
25
        {options.map(({ name, value }) => (
35
          <MenuItem key={value} value={value}>
26
          <option key={value} value={value}>
36
            {name}
27
            {name}
37
          </MenuItem>
28
          </option>
38
        ))}
29
        ))}
39
      </MuiSelect>
30
      </MuiSelect>
40
      {error ? <FormErrorFeedback>{error}</FormErrorFeedback> : null}
31
      {error ? <FormErrorFeedback>{error}</FormErrorFeedback> : null}