lbry-desktop/ui/component/common/form-components/input-select.jsx
Rafael 1f367c641e Cleanup Form-Field
- avoid declaring components inside the body function of parent components https://dev.to/borasvm/react-create-component-inside-a-component-456b
2022-02-08 12:35:40 -05:00

25 lines
629 B
JavaScript

// @flow
import * as React from 'react';
import { Label } from './common';
type InputSelectProps = {
name: string,
className?: string,
label?: any,
errorMessage?: any,
children?: any,
};
export const InputSelect = (inputSelectProps: InputSelectProps) => {
const { name, className, errorMessage, label, children, ...inputProps } = inputSelectProps;
return (
<fieldset-section class={className || ''}>
{(label || errorMessage) && <Label name={name} label={label} errorMessage={errorMessage} />}
<select id={name} {...inputProps}>
{children}
</select>
</fieldset-section>
);
};