UNPKG

@blocklet/payment-react

Version:

Reusable react components for payment kit v2

68 lines (67 loc) 1.72 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); module.exports = PaymentError; var _jsxRuntime = require("react/jsx-runtime"); var _material = require("@mui/material"); function getHeightStyle(mode) { switch (mode) { case "standalone": return { height: "100vh", maxHeight: "100%" }; // 独立模式下,高度为100vh default: return { height: "auto", minHeight: 200 }; } } function PaymentError({ title, description, button = "Back", mode = "standalone" }) { const heightStyle = getHeightStyle(mode); return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, { sx: [{ alignItems: "center", justifyContent: "center" }, ...(Array.isArray(heightStyle) ? heightStyle : [heightStyle])], children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, { direction: "column", sx: { alignItems: "center", justifyContent: "center", width: "280px" }, children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, { variant: "h5", sx: { mb: 2 }, children: title }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, { variant: "body1", sx: { mb: 2, textAlign: "center" }, children: description }), typeof button === "string" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, { variant: "text", size: "small", sx: { color: "text.link" }, component: _material.Link, href: window.blocklet?.appUrl, children: button }) : button] }) }); }