"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TestResult = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const UIStyleConstants_1 = require("@appglue/common/src/Common/UIStyleConstants");
const react_1 = tslib_1.__importDefault(require("react"));
const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
const TestContext_1 = require("./TestContext");
const TestingConstants_1 = require("./TestingConstants");
const TestResult = ({ executableId }) => {
    const testContext = react_1.default.useContext(TestContext_1.TestContext);
    if (!testContext)
        return null;
    const currentTestItem = testContext.findItem(executableId);
    return ((0, jsx_runtime_1.jsxs)(TestResultRender, { isError: testContext?.isError || (!!currentTestItem && !currentTestItem.result), "data-testid": "test-result", children: [(0, jsx_runtime_1.jsx)(TestResultLabelRender, { className: "test-result-label", children: "Result" }), (0, jsx_runtime_1.jsx)(TestResultValueRender, { className: "test-result-value", children: currentTestItem?.result || "No Result" })] }));
};
exports.TestResult = TestResult;
const TestResultRender = styled_components_1.default.div `
    margin-top: 20px;

    display: flex;
    border-radius: 4px;
    ${(props) => props.isError
    ? `
                border: 1px solid ${TestingConstants_1.TestingConstants.BORDER_FAIL};

                .test-result-label {
                    background: ${TestingConstants_1.TestingConstants.BACKGROUND_FAIL};
                }

                .test-result-value {
                    color: ${UIStyleConstants_1.UIStyleConstants.RED_COLOR};
                }
            `
    : `
                border: 1px solid ${TestingConstants_1.TestingConstants.BORDER_SUCCESS};
                .test-result-label {
                    background: ${TestingConstants_1.TestingConstants.BACKGROUND_SUCCESS};
                }

                .test-result-value {
                    color: rgba(53, 182, 135, 0.7);
                }
            `}
`;
const TestResultValueRender = styled_components_1.default.div `
    font-size: 14px;
    font-style: normal;
    font-weight: 500;
    line-height: 20px;
    letter-spacing: 0em;
    text-align: left;

    padding: 8px 12px;
`;
const TestResultLabelRender = styled_components_1.default.div `
    //styleName: text/Inter Medium 14px;

    font-size: 14px;
    font-style: normal;
    font-weight: 500;
    line-height: 20px;
    letter-spacing: 0em;
    text-align: left;

    padding: 8px 12px;

    color: #606881;
`;
//# sourceMappingURL=TestResult.js.map