import { __assign, __rest } from "tslib";
import React, { useContext } from 'react';
import classNames from 'classnames';
import { ConfigContext } from '../config-provider/config-context';
import { getPrefixCls } from '../_utils/general';
import { CheckCircle, CloseCircle, InfoCircle, LoadingCircle, WarningCircle, } from '../_utils/components';
var Result = React.forwardRef(function (props, ref) {
    var _a = props.status, status = _a === void 0 ? 'info' : _a, customisedCls = props.prefixCls, title = props.title, subtitle = props.subtitle, icon = props.icon, extra = props.extra, className = props.className, children = props.children, otherProps = __rest(props, ["status", "prefixCls", "title", "subtitle", "icon", "extra", "className", "children"]);
    var configContext = useContext(ConfigContext);
    var prefixCls = getPrefixCls('result', configContext.prefixCls, customisedCls);
    var cls = classNames(prefixCls, className, prefixCls + "_" + status);
    var renderIcon = function () {
        if (React.isValidElement(icon)) {
            return icon;
        }
        else {
            var iconSize = 80;
            switch (status) {
                case 'success':
                    return React.createElement(CheckCircle, { size: iconSize });
                case 'info':
                    return React.createElement(InfoCircle, { size: iconSize });
                case 'warning':
                    return React.createElement(WarningCircle, { size: iconSize });
                case 'error':
                    return React.createElement(CloseCircle, { size: iconSize });
                case 'loading':
                    return React.createElement(LoadingCircle, { size: iconSize, className: prefixCls + "__icon" });
            }
        }
        return null;
    };
    return (React.createElement("div", __assign({}, otherProps, { ref: ref, className: cls }),
        React.createElement("div", { className: prefixCls + "__icon-container" }, renderIcon()),
        title && React.createElement("div", { className: prefixCls + "__title" }, title),
        subtitle && React.createElement("div", { className: prefixCls + "__subtitle" }, subtitle),
        extra && React.createElement("div", { className: prefixCls + "__extra" }, extra),
        children && React.createElement("div", { className: prefixCls + "__content" }, children)));
});
Result.displayName = 'Result';
export default Result;
//# sourceMappingURL=index.js.map