UNPKG

funuicss

Version:

React and Next.js component UI Library for creating Easy and good looking websites with fewer lines of code. Elevate your web development experience with our cutting-edge React/Next.js component UI Library. Craft stunning websites effortlessly, boasting b

56 lines (55 loc) 2.8 kB
"use strict"; 'use client'; 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 () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var React = __importStar(require("react")); var SnackBar = function (_a) { var message = _a.message, close = _a.close, open = _a.open, setOpen = _a.setOpen, position = _a.position, funcss = _a.funcss, animation = _a.animation, _b = _a.duration, duration = _b === void 0 ? 0.3 : _b, _c = _a.autoHide, autoHide = _c === void 0 ? false : _c, _d = _a.autoHideDuration, autoHideDuration = _d === void 0 ? 3000 : _d, flat = _a.flat; React.useEffect(function () { if (open && autoHide) { var timer_1 = setTimeout(function () { setOpen(false); }, autoHideDuration); return function () { return clearTimeout(timer_1); }; } }, [open, autoHide, autoHideDuration, setOpen]); if (!open) return null; return (React.createElement("div", { className: "snackbar ".concat(position, " ").concat(funcss || '', " ").concat(flat ? 'flat' : ''), style: { animation: "".concat(duration, "s ").concat(animation || 'SlideUp') } }, React.createElement("div", { className: "snackbar-content" }, React.createElement("div", { className: "snackbar-body" }, message), close && (React.createElement("div", { className: "close-snackbar pointer", onClick: function () { return setOpen ? setOpen(false) : null; } }, close))))); }; exports.default = SnackBar;