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

function IconLoaderComponent(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 || 'font';
    const loadingKls = spin ? ` ${prefix}-icon-loading` : '';
    return <svg className={`${prefix}-icon ${prefix}-icon-Loader${loadingKls} ${className}`} width={width} height={height} viewBox="0 0 24 24" fill={useCurrentColor ? 'currentColor' : '#000'} xmlns="http://www.w3.org/2000/svg" {...rest} ref={ref}><path d="M11 22V18C11 17.4477 11.4477 17 12 17C12.5523 17 13 17.4477 13 18V22C13 22.5523 12.5523 23 12 23C11.4477 23 11 22.5523 11 22ZM7.09277 15.4932C7.4833 15.1026 8.11631 15.1026 8.50684 15.4932C8.89729 15.8837 8.89734 16.5167 8.50684 16.9072L5.60742 19.8066C5.2169 20.1972 4.58291 20.1972 4.19238 19.8066C3.8023 19.4161 3.80207 18.783 4.19238 18.3926L7.09277 15.4932ZM15.4932 15.4932C15.8837 15.1026 16.5167 15.1026 16.9072 15.4932L19.8066 18.3926C20.1972 18.7831 20.1972 19.4161 19.8066 19.8066C19.4161 20.1972 18.7831 20.1972 18.3926 19.8066L15.4932 16.9072C15.1026 16.5167 15.1026 15.8837 15.4932 15.4932ZM6 11C6.55228 11 7 11.4477 7 12C7 12.5523 6.55228 13 6 13H2C1.44772 13 1 12.5523 1 12C1 11.4477 1.44772 11 2 11H6ZM22 11C22.5523 11 23 11.4477 23 12C23 12.5523 22.5523 13 22 13H18C17.4477 13 17 12.5523 17 12C17 11.4477 17.4477 11 18 11H22ZM4.19238 4.19238C4.58291 3.80186 5.2169 3.80186 5.60742 4.19238L8.50684 7.09277C8.89736 7.4833 8.89736 8.11631 8.50684 8.50684C8.11631 8.89736 7.4833 8.89736 7.09277 8.50684L4.19238 5.60742C3.80186 5.2169 3.80186 4.58291 4.19238 4.19238ZM18.3926 4.19238C18.783 3.80207 19.4161 3.8023 19.8066 4.19238C20.1972 4.58291 20.1972 5.2169 19.8066 5.60742L16.9072 8.50684C16.5167 8.89734 15.8837 8.89729 15.4932 8.50684C15.1026 8.11631 15.1026 7.4833 15.4932 7.09277L18.3926 4.19238ZM11 6V2C11 1.44772 11.4477 1 12 1C12.5523 1 13 1.44772 13 2V6C13 6.55228 12.5523 7 12 7C11.4477 7 11 6.55228 11 6Z"/></svg>;
}

const IconLoader = React.forwardRef(IconLoaderComponent);
export default IconLoader;
