decentraland-ui
Version:
Decentraland's UI components and styles
80 lines (79 loc) • 3.99 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NetworkAlert = void 0;
var React = __importStar(require("react"));
var Icon_1 = __importDefault(require("semantic-ui-react/dist/commonjs/elements/Icon"));
var Button_1 = require("../Button/Button");
var Header_1 = require("../Header/Header");
require("./NetworkAlert.css");
var NetworkAlert = /** @class */ (function (_super) {
__extends(NetworkAlert, _super);
function NetworkAlert() {
return _super !== null && _super.apply(this, arguments) || this;
}
NetworkAlert.prototype.render = function () {
var _a = this.props, i18n = _a.i18n, onSwitchNetwork = _a.onSwitchNetwork;
var title = i18n.title, content = i18n.content, action = i18n.action;
return (React.createElement("div", { className: "NetworkAlert", "aria-live": "polite" },
React.createElement("div", { className: "center" },
React.createElement("div", { className: "description" },
React.createElement(Icon_1.default, { className: "warning-icon", name: "warning sign", size: "big", color: "yellow" }),
React.createElement("div", null,
React.createElement(Header_1.Header, { as: "h4", className: "title" }, title),
React.createElement("p", null, content))),
React.createElement("div", { className: "action" },
React.createElement(Button_1.Button, { inverted: true, onClick: onSwitchNetwork }, action)))));
};
NetworkAlert.defaultProps = {
i18n: {
title: 'Your wallet is connected to a partially supported network (Polygon)',
content: (React.createElement("span", null,
"Switch to Ethereum Mainnet if you want to use all the features of this app. ",
React.createElement("a", { href: "" }, "Learn more"))),
action: 'Switch Network'
}
};
return NetworkAlert;
}(React.PureComponent));
exports.NetworkAlert = NetworkAlert;