/** @jsx jsx */ import { css, jsx } from "@emotion/core"; // import { css, cx } from "emotion"; import * as React from "react"; import Select, { components } from "react-select"; import { IconAtom, TextAtom } from "../../atoms"; // import * as angleDown from './angle-down.png'; // import * as angleDownGray from './angle-down-gray.png'; // @ts-ignore import COLORS from "../../constants/colors"; const DropdownIndicator = (props: any) => components.DropdownIndicator && (
{/* */} {/* */}
); class SelectOrganism extends React.Component { public state = { isFocus: false, isActive: !!this.props.value, }; public selectRef: any; public onFocus = () => { this.setState({ isFocus: true }); if (this.selectRef) { this.selectRef.focus(); } } public onBlur = () => { this.setState({ isFocus: false }); } public handleChange = (e: any) => { this.props.onChange(e.value || null); this.setState({ isActive: true }); } public render() { const { isFocus, isActive } = this.state; const { value, options, error, name, placeholder, label, icon, className, disabled, required, } = this.props; return (
{icon && ( )}
{required && (isFocus || isActive) ? label : !required ? label : `* ${label}`}