UNPKG

@hypernetlabs/web-ui

Version:
37 lines 2.05 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.GovernanceVotingCard = void 0; const react_1 = __importDefault(require("react")); const core_1 = require("@material-ui/core"); const GovernanceVotingCard_style_1 = require("../../components/GovernanceVotingCard/GovernanceVotingCard.style"); const components_1 = require("../../components"); const theme_1 = require("../../theme"); const colorConfig = { for: theme_1.colors.GREEN700, against: theme_1.colors.RED700, abstain: theme_1.colors.GRAY500, }; const titleConfig = { for: "For", against: "Against", abstain: "Abstain", }; const GovernanceVotingCard = (props) => { const { type, value, progressValue, onVoteClick, isVoted, showVoteButton = true, disableVoteButton, } = props; const classes = (0, GovernanceVotingCard_style_1.useStyles)({ isVoted }); return (react_1.default.createElement(core_1.Box, { className: classes.wrapper }, react_1.default.createElement(core_1.Box, { className: classes.titleWrapper }, react_1.default.createElement(core_1.Typography, { className: classes.titleText, variant: "h6" }, titleConfig[type]), react_1.default.createElement(core_1.Typography, { className: classes.valueText, variant: "h6" }, value)), react_1.default.createElement(components_1.GovernanceProgress, { value: progressValue, color: colorConfig[type] }), showVoteButton && (react_1.default.createElement(components_1.GovernanceButton, { className: classes.button, fullWidth: true, color: "primary", size: "small", variant: isVoted ? "contained" : "outlined", disabled: disableVoteButton, onClick: () => { if (!isVoted) { onVoteClick(); } } }, isVoted ? "Voted!" : "Vote")))); }; exports.GovernanceVotingCard = GovernanceVotingCard; //# sourceMappingURL=GovernanceVotingCard.js.map