"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChangeView = void 0;
var react_1 = __importDefault(require("react"));
var classnames_1 = __importDefault(require("classnames"));
var ramda_1 = require("ramda");
var ArrowRightAlt_1 = __importDefault(require("@mui/icons-material/ArrowRightAlt"));
var OperationChip_1 = require("../../../OperationChip");
var ChangeView_module_css_1 = __importDefault(require("./ChangeView.module.css"));
var ChangeView = function (_a) {
    var label = _a.label, oldValue = _a.oldValue, newValue = _a.newValue, operation = _a.operation, className = _a.className;
    var value = oldValue || newValue;
    return (react_1.default.createElement("div", { className: (0, classnames_1.default)(ChangeView_module_css_1.default.field, className) },
        react_1.default.createElement("span", { className: ChangeView_module_css_1.default.fieldName },
            label,
            ":"),
        !(0, ramda_1.isNil)(value) && (react_1.default.createElement("span", { className: ChangeView_module_css_1.default.difference },
            value,
            newValue && oldValue && (react_1.default.createElement(react_1.default.Fragment, null,
                react_1.default.createElement(ArrowRightAlt_1.default, { "data-reltio-id": "arrow-right", className: ChangeView_module_css_1.default.arrow }),
                newValue)))),
        operation && react_1.default.createElement(OperationChip_1.OperationChip, { operation: operation })));
};
exports.ChangeView = ChangeView;
