UNPKG

@premieroctet/next-admin

Version:

Next-Admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your proje

58 lines (57 loc) 2.7 kB
"use client"; import { jsx, jsxs } from "react/jsx-runtime"; import { CheckCircleIcon, InformationCircleIcon, XCircleIcon } from "@heroicons/react/24/outline"; import external_clsx_default from "clsx"; import { cloneElement, useEffect } from "react"; import { useMessage } from "../context/MessageContext.mjs"; const Message = (props)=>{ const { message, hideMessage } = useMessage(); useEffect(()=>{ if (message) window.scrollTo({ top: 0, behavior: "smooth" }); }, [ hideMessage, message ]); return message && /*#__PURE__*/ jsx("div", { ...props, className: external_clsx_default("rounded-md p-4", { "bg-nextadmin-alert-success-background dark:bg-dark-nextadmin-alert-success-background text-nextadmin-alert-success-content dark:text-dark-nextadmin-alert-success-content": "success" === message.type, "bg-nextadmin-alert-error-background dark:bg-dark-nextadmin-alert-error-background text-nextadmin-alert-error-content dark:text-dark-nextadmin-alert-error-content": "error" === message.type, "bg-nextadmin-alert-info-background dark:bg-dark-nextadmin-alert-info-background text-nextadmin-alert-info-content dark:text-dark-nextadmin-alert-info-content": "info" === message.type }, props.className), children: /*#__PURE__*/ jsxs("div", { className: "flex", children: [ /*#__PURE__*/ jsxs("div", { className: "flex-shrink-0", children: [ "success" === message.type && /*#__PURE__*/ jsx(CheckCircleIcon, { className: "h-5 w-5", "aria-hidden": "true" }), "error" === message.type && /*#__PURE__*/ jsx(XCircleIcon, { className: "h-5 w-5", "aria-hidden": "true" }), "info" === message.type && /*#__PURE__*/ jsx(InformationCircleIcon, { className: "h-5 w-5", "aria-hidden": "true" }) ] }), /*#__PURE__*/ jsx("div", { className: "ml-3 text-sm font-medium", children: message.component ? /*#__PURE__*/ cloneElement(message.component, { message: message.message }) : /*#__PURE__*/ jsx("p", { children: message.message }) }) ] }) }); }; export { Message };