import React, { PureComponent } from 'react'; import './SwapDropdown.scss'; import { DropDown } from 'components/ui'; export interface SingleCoin { id: string; name: string; image: string; status: string; } interface Props { options: SingleCoin[]; value: string; onChange(value: T): void; } const ValueComp: React.SFC = (props: any) => { return (
{props.value.label}
); }; const OptionComp: React.SFC = (props: any) => { const handleMouseDown = event => { event.preventDefault(); event.stopPropagation(); props.onSelect(props.option, event); }; const handleMouseEnter = event => { props.onFocus(props.option, event); }; const handleMouseMove = event => { if (props.isFocused) { return; } props.onFocus(props.option, event); }; return (
{props.option.label}
); }; class SwapDropdown extends PureComponent> { public render() { const { options, value, onChange } = this.props; const mappedOptions = options.map(opt => { return { label: opt.id, value: opt.name, img: opt.image, status: opt.status }; }); return ( { return ; }} value={value} clearable={false} onChange={onChange} valueComponent={(props: any) => { return ; }} /> ); } } export default SwapDropdown;