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

function IconBlockComponent(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-block${loadingKls} ${className}`} width={width} height={height} viewBox="0 0 48 48" fill={useCurrentColor ? 'currentColor' : '#000'} xmlns="http://www.w3.org/2000/svg" {...rest} ref={ref}><path fillRule="evenodd" clipRule="evenodd" d="M42.87 9.96L24.856 1.413a2 2 0 00-1.716 0L5.155 9.96a2 2 0 00-1.142 1.806v22.463a2 2 0 001.14 1.806l17.986 8.564a2 2 0 001.718 0l18.015-8.564a2 2 0 001.14-1.806V11.765A2 2 0 0042.87 9.96zM8.013 32.964L8.012 15.56l13.85 6.953.037.018.26 17.171-14.146-6.736zm32-17.409L26.036 22.52l-.135.061.256 16.971 13.856-6.587V15.556zm-30.01-3.474l13.996-6.647 14.017 6.648-13.763 6.855a.667.667 0 01-.596 0l-13.654-6.856z"/></svg>;
}

const IconBlock = React.forwardRef(IconBlockComponent);
export default IconBlock;
