Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1782 | Rev 1785 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

import React from 'react'
import { FormControl, InputLabel, Select as MuiSelect } from '@mui/material'

import FormErrorFeedback from '../form/FormErrorFeedback'

const Select = ({
  label = '',
  options = [],
  inputRef = null,
  name = '',
  value = '',
  onChange = () => {},
  error = null
}) => {
  return (
    <FormControl fullWidth>
      {label ? <InputLabel htmlFor={name}>{label}</InputLabel> : null}
      <MuiSelect
        ref={inputRef}
        value={value}
        onChange={onChange}
        id={name}
        fullWidth
      >
        {options.map(({ name, value }) => (
          <option key={value} value={value}>
            {name}
          </option>
        ))}
      </MuiSelect>
      {error ? <FormErrorFeedback>{error}</FormErrorFeedback> : null}
    </FormControl>
  )
}

export default Select