Skip to content

Commit

Permalink
ULMS-3110 Updated notify component
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkonst committed Jul 17, 2024
1 parent 92cbcc4 commit aaba244
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/notify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ulms/notify",
"version": "1.1.0",
"version": "1.2.0",
"license": "MIT",
"main": "index.js",
"module": "es/index.js",
Expand Down
22 changes: 20 additions & 2 deletions packages/notify/src/notify.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable react/prop-types,react/jsx-props-no-spreading */
import React from 'react'
import React, { useEffect } from 'react'
import cn from 'classnames-es'
import { cssTransition, toast, ToastContainer } from 'react-toastify'

Expand All @@ -21,7 +21,25 @@ const ALERT_SIZE = {
SMALL: 's',
}

function NotificationContainer({ className, containerProps = {}, isCompact }) {
function NotificationContainer({
className,
containerProps = {},
isCompact,
onMount,
onUnmount,
}) {
useEffect(() => {
if (onMount) {
onMount()
}

return () => {
if (onUnmount) {
onUnmount()
}
}
}, [])

return (
<ToastContainer
autoClose={4000}
Expand Down

0 comments on commit aaba244

Please sign in to comment.