import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import React from "react";
import styled from "styled-components";
import { TestContext } from "../../Tester/TestContext";
import { TestingConstants } from "./TestingConstants";
export const TestResult = ({ executableId }) => {
    const testContext = React.useContext(TestContext);
    if (!testContext)
        return null;
    const currentTestItem = testContext.findItem(executableId);
    return (_jsxs(TestResultRender, Object.assign({ isError: (testContext === null || testContext === void 0 ? void 0 : testContext.isError) || (!!currentTestItem && !currentTestItem.result), "data-testid": "test-result" }, { children: [_jsx(TestResultLabelRender, Object.assign({ className: "test-result-label" }, { children: "Result" }), void 0),
            _jsx(TestResultValueRender, Object.assign({ className: "test-result-value" }, { children: (currentTestItem === null || currentTestItem === void 0 ? void 0 : currentTestItem.result) || "No Result" }), void 0)] }), void 0));
};
const TestResultRender = styled.div `
    margin-top: 20px;

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

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

                .test-result-value {
                    color: #EE3E54;
                }
            `
    : `
                border: 1px solid ${TestingConstants.BORDER_SUCCESS};
                .test-result-label {
                    background: ${TestingConstants.BACKGROUND_SUCCESS};
                }

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

    padding: 8px 12px;
`;
const TestResultLabelRender = styled.div `
    //styleName: text/Inter Medium 14px;
    font-family: Inter;
    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