Proyectos de Subversion LeadersLinked - SPA

Rev

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

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