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

function IconCloseComponent(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-close${loadingKls} ${className}`} width={width} height={height} xmlns="http://www.w3.org/2000/svg" fill={useCurrentColor ? 'currentColor' : '#000'} viewBox="0 0 16 16" {...rest} ref={ref}><path d="m11.115 4.17.715.714a.578.578 0 0 1 0 .817L9.531 8l2.3 2.299a.578.578 0 0 1 0 .817l-.716.715a.578.578 0 0 1-.817 0l-2.3-2.3-2.296 2.299a.578.578 0 0 1-.817 0l-.715-.715a.578.578 0 0 1 0-.817L6.466 8 4.17 5.702a.578.578 0 0 1 0-.817l.715-.715a.578.578 0 0 1 .817 0l2.297 2.297 2.3-2.298a.578.578 0 0 1 .816 0Z"/></svg>;
}

const IconClose = React.forwardRef(IconCloseComponent);
export default IconClose;
