UNPKG

sccoreui

Version:

ui-sccore

48 lines (47 loc) 4.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const jsx_runtime_1 = require("react/jsx-runtime"); const button_1 = require("primereact/button"); const toast_1 = require("primereact/toast"); const react_1 = require("react"); const svg_component_1 = tslib_1.__importDefault(require("../../directives/svg-component")); const ToastComponent = () => { const toast = (0, react_1.useRef)(null); const showSuccess = () => { var _a; (_a = toast.current) === null || _a === void 0 ? void 0 : _a.show({ severity: "success", summary: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex" }, { children: [(0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "success-tick-mark" }), "Successfully connected to Quickbooks"] })) })), life: 3000, }); }; const showInfo = () => { var _a; (_a = toast.current) === null || _a === void 0 ? void 0 : _a.show({ severity: "info", summary: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex" }, { children: [(0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "info-icon-circle" }), "Default template made inactive"] })) })), life: 300000, }); }; const showError = () => { var _a; (_a = toast.current) === null || _a === void 0 ? void 0 : _a.show({ severity: "error", summary: ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex" }, { children: [(0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "info-icon" }), (0, jsx_runtime_1.jsx)("h4", Object.assign({ className: "text-white font-light" }, { children: "There was a problem connecting to the app" }))] }))), detail: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "pl-6" }, { children: ["Couldn\u2019t connect to the app because of insufficient permissions", (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex gap-4" }, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { label: "Learn more", link: true, className: "text-white p-0" }), (0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({ label: "Retry", link: true, className: "text-white p-0 gap-2" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "arrow-right-white" }) }))] }))] })) })), life: 300000, }); }; const showWarning = () => { var _a; (_a = toast.current) === null || _a === void 0 ? void 0 : _a.show({ severity: "warn", summary: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex" }, { children: [(0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "success-tick-mark" }), "Successfully connected to Quickbooks"] })) })), detail: "Message Content", life: 3000, }); }; return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h2", Object.assign({ className: "flex bg-gray-200 p-3 justify-content-center mb-4" }, { children: "Toast Messages" })), (0, jsx_runtime_1.jsx)("object", { id: "svg1", data: "./down_arrow.svg", type: "image/svg+xml" }), (0, jsx_runtime_1.jsx)(toast_1.Toast, { ref: toast }), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex gap-2 justify-content-center align-items-center" }, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { label: "Success", className: "p-button-success border-round-3xl", onClick: showSuccess }), (0, jsx_runtime_1.jsx)(button_1.Button, { label: "Info", className: "p-button-info border-round-3xl", onClick: showInfo }), (0, jsx_runtime_1.jsx)(button_1.Button, { label: "Warn", className: "p-button-warning border-round-3xl", onClick: showWarning }), (0, jsx_runtime_1.jsx)(button_1.Button, { label: "Error", className: "p-button-danger border-round-3xl", onClick: showError })] }))] })); }; exports.default = ToastComponent;