import * as React from 'react'; import { Wrapper, SelectStyled, Label } from './Select.styled'; import Icons from '../Icons'; export interface IProps { options?: any; label: string; onChange: (e?: any) => any; } export default class Select extends React.PureComponent { state = { selectedValue: '', degree: 180, } renderHTMLOptions = () => this.props.options .map((item: { value: string; label: string }) => ( )) handleSelectChange = ({ currentTarget: { value } }: React.ChangeEvent) => { this.setState({ selectedValue: value }); if (value !== 'hide') { this.props.onChange(value); return; } this.props.onChange(undefined); }; isInvalid = () => this.state.selectedValue === 'hide'; render () { const { selectedValue, degree } = this.state; const { label } = this.props; return ( this.setState({ degree: 180 })} > {this.renderHTMLOptions()} ); } }