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

function IconLeftComponent(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-left${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="M7.94462 8.12337C8.13988 8.31863 8.13988 8.63521 7.94462 8.83047L7.59106 9.18403C7.3958 9.37929 7.07922 9.37929 6.88396 9.18403L4.05553 6.3556C3.95738 6.25745 3.90856 6.12864 3.90909 5.99999C3.90856 5.87135 3.95738 5.74254 4.05553 5.64438L6.88396 2.81596C7.07922 2.62069 7.3958 2.62069 7.59106 2.81596L7.94462 3.16951C8.13988 3.36477 8.13988 3.68135 7.94462 3.87662L5.82124 5.99999L7.94462 8.12337Z"/></svg>;
}

const IconLeft = React.forwardRef(IconLeftComponent);
export default IconLeft;
