import React, { ForwardedRef, useContext } from 'react';
import { OriginIconProps } from '../type';
import { Context } from '../context';

function IconSearchComponent(props: OriginIconProps, ref: ForwardedRef<SVGSVGElement>) {
    const { prefix: prefixFromContext } = useContext(Context);
    const { className = '', prefix: prefixFromProps, width = '1em', height = '1em', useCurrentColor = true, spin, ...rest } = props;

    const prefix = prefixFromProps || prefixFromContext || 'hiagent';
    const loadingKls = spin ? ` ${prefix}-icon-loading` : '';
    return <svg className={`${prefix}-icon ${prefix}-icon-search${loadingKls} ${className}`} width={width} height={height} viewBox="0 0 12 12" fill={useCurrentColor ? 'currentColor' : '#000'} xmlns="http://www.w3.org/2000/svg" {...rest} ref={ref}><path fillRule="evenodd" clipRule="evenodd" d="M5.78186 2.11719C3.75825 2.11719 2.1178 3.75764 2.1178 5.78125C2.1178 7.80486 3.75825 9.44531 5.78186 9.44531C7.80547 9.44531 9.44592 7.80486 9.44592 5.78125C9.44592 3.75764 7.80547 2.11719 5.78186 2.11719ZM1.13342 5.78125C1.13342 3.21399 3.2146 1.13281 5.78186 1.13281C8.34912 1.13281 10.4303 3.21399 10.4303 5.78125C10.4303 8.34851 8.34912 10.4297 5.78186 10.4297C3.2146 10.4297 1.13342 8.34851 1.13342 5.78125Z"/><path fillRule="evenodd" clipRule="evenodd" d="M9.15258 9.15197C9.34479 8.95976 9.65643 8.95976 9.84864 9.15197L10.7236 10.027C10.9159 10.2192 10.9159 10.5308 10.7236 10.723C10.5314 10.9152 10.2198 10.9152 10.0276 10.723L9.15258 9.84803C8.96037 9.65582 8.96037 9.34418 9.15258 9.15197Z"/></svg>;
}

const IconSearch = React.forwardRef(IconSearchComponent);
export default IconSearch;
