File size: 727 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import clsx from 'clsx';
import { Component } from 'react';
import type { LegacyRef, HTMLProps } from 'react';
import './style.scss';
export interface FormSelectProps {
inputRef?: LegacyRef< HTMLSelectElement >;
className?: string;
isError?: boolean;
}
class FormSelect extends Component<
FormSelectProps & Omit< HTMLProps< HTMLSelectElement >, 'ref' >
> {
static defaultProps = {
isError: false,
};
render() {
const { inputRef, className, isError, ...props } = this.props;
const classes = clsx( className, 'form-select', {
'is-error': isError,
} );
return (
<select { ...props } ref={ inputRef } className={ classes }>
{ this.props.children }
</select>
);
}
}
export default FormSelect;
|