@hypernetlabs/web-ui
Version:
Web ui react components for hypernet protocol
61 lines • 2.5 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GovernanceTag = exports.ETagColor = void 0;
const react_1 = __importDefault(require("react"));
const core_1 = require("@material-ui/core");
const theme_1 = require("../../theme");
const GovernanceTag_style_1 = require("../../components/GovernanceTag/GovernanceTag.style");
var ETagColor;
(function (ETagColor) {
ETagColor[ETagColor["BLUE"] = 0] = "BLUE";
ETagColor[ETagColor["PURPLE"] = 1] = "PURPLE";
ETagColor[ETagColor["GREEN"] = 2] = "GREEN";
ETagColor[ETagColor["GRAY"] = 3] = "GRAY";
ETagColor[ETagColor["RED"] = 4] = "RED";
})(ETagColor = exports.ETagColor || (exports.ETagColor = {}));
const GovernanceTag = (props) => {
const { text, color } = props;
const config = getTagConfig(color);
const classes = (0, GovernanceTag_style_1.useStyles)({ config });
return (react_1.default.createElement(core_1.Box, { className: classes.wrapper },
react_1.default.createElement(core_1.Typography, { className: classes.text, variant: "body1" }, text)));
};
exports.GovernanceTag = GovernanceTag;
const getTagConfig = (color) => {
switch (color) {
case ETagColor.BLUE:
return {
backgroundColor: theme_1.colors.BLUE100,
borderColor: theme_1.colors.BLUE200,
textColor: theme_1.colors.BLUE700,
};
case ETagColor.PURPLE:
return {
backgroundColor: theme_1.colors.PURPLE100,
borderColor: theme_1.colors.PURPLE200,
textColor: theme_1.colors.PURPLE700,
};
case ETagColor.GREEN:
return {
backgroundColor: theme_1.colors.GREEN100,
borderColor: theme_1.colors.GREEN200,
textColor: theme_1.colors.GREEN700,
};
case ETagColor.RED:
return {
backgroundColor: theme_1.colors.RED100,
borderColor: theme_1.colors.RED200,
textColor: theme_1.colors.RED700,
};
case ETagColor.GRAY:
return {
backgroundColor: theme_1.colors.GRAY100,
borderColor: theme_1.colors.GRAY200,
textColor: theme_1.colors.GRAY700,
};
}
};
//# sourceMappingURL=GovernanceTag.js.map