"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var styled_components_1 = __importDefault(require("styled-components"));
var styleConstants_1 = require("../styleConstants");
var Button_1 = require("../Button");
var icons_1 = require("../icons");
var StyledVoteButton = styled_components_1.default.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  flex-grow: 1;\n\n  svg {\n    margin: 0 8px -3px 0;\n  }\n\n  ", ", ", " {\n    font-size: 13px;\n    font-weight: bold;\n    letter-spacing: 0;\n    line-height: 14px;\n    padding: 18px 0;\n    text-transform: uppercase;\n    width: 100%;\n  }\n\n  ", " {\n    border: 2px solid ", ";\n    border-radius: 2px;\n  }\n\n  ", ":hover .svg-fill {\n    fill: ", ";\n  }\n\n  ", ":hover .svg-stroke {\n    stroke: ", ";\n  }\n"], ["\n  flex-grow: 1;\n\n  svg {\n    margin: 0 8px -3px 0;\n  }\n\n  ", ", ", " {\n    font-size: 13px;\n    font-weight: bold;\n    letter-spacing: 0;\n    line-height: 14px;\n    padding: 18px 0;\n    text-transform: uppercase;\n    width: 100%;\n  }\n\n  ", " {\n    border: 2px solid ", ";\n    border-radius: 2px;\n  }\n\n  ", ":hover .svg-fill {\n    fill: ", ";\n  }\n\n  ", ":hover .svg-stroke {\n    stroke: ", ";\n  }\n"])), Button_1.Button, Button_1.InvertedButton, Button_1.Button, styleConstants_1.colors.accent.CIVIL_BLUE, Button_1.InvertedButton, styleConstants_1.colors.basic.WHITE, Button_1.InvertedButton, styleConstants_1.colors.basic.WHITE);
var styledComponents_1 = require("./styledComponents");
var textComponents_1 = require("./textComponents");
var VoteButton = function (props) {
    var buttonText;
    var voteOption = props.voteOption, buttonVoteOptionValue = props.buttonVoteOptionValue, isAppealChallenge = props.isAppealChallenge;
    var isSelected = voteOption === buttonVoteOptionValue;
    var ButtonComponent = isSelected ? Button_1.Button : Button_1.InvertedButton;
    var iconColor = isSelected ? styleConstants_1.colors.basic.WHITE : styleConstants_1.colors.accent.CIVIL_BLUE;
    var onClick = function () {
        props.onInputChange({ voteOption: buttonVoteOptionValue });
    };
    if (buttonVoteOptionValue === "1") {
        if (isAppealChallenge) {
            buttonText = React.createElement(textComponents_1.OverturnActionText, null);
        }
        else {
            buttonText = (React.createElement(React.Fragment, null,
                React.createElement(icons_1.HollowGreenCheck, { width: 17, height: 17, color: iconColor }),
                " ",
                React.createElement(textComponents_1.WhitelistActionText, null)));
        }
    }
    else if (props.buttonVoteOptionValue === "0") {
        if (props.isAppealChallenge) {
            buttonText = React.createElement(textComponents_1.UpholdActionText, null);
        }
        else {
            buttonText = (React.createElement(React.Fragment, null,
                React.createElement(icons_1.HollowRedNoGood, { width: 17, height: 17, color: iconColor }),
                " ",
                React.createElement(textComponents_1.RemoveActionText, null)));
        }
    }
    return (React.createElement(StyledVoteButton, null,
        React.createElement(ButtonComponent, { onClick: onClick, size: Button_1.buttonSizes.MEDIUM, theme: styledComponents_1.buttonTheme }, buttonText)));
};
exports.default = VoteButton;
var templateObject_1;
//# sourceMappingURL=VoteButton.js.map