1.2.0 • Published 12 months ago

@ulms/notify v1.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

Notify

Based on a react-toastify.

How to use

// notify.js
import { createNotify } from '@ulms/notify'
import { Alert } from 'PATH_TO_ANY_ALERT_COMPONENT' // any ui component

// Set the default alert component and override the default settings if required
export const notify = createNotify(Alert, {
  size: 'l', // 's'|'l' ('s' - default value )
})

// app.jsx
import { NotificationContainer } from '@ulms/notify'
import '@ulms/notify/es/index.css'

function App() {
  return (
    <div>
      <NotificationContainer
        isCompact={isMobileLayout} // it will change the position of the notification component
        {...containerProps} // pass any props from this page https://fkhadra.github.io/react-toastify/api/toast-container
      />
    </div>
  )
}

The positioning of the alert depends on the specified size.
The alert size 's' position has the value 'top-center'.
The alert size 'l' position has the value 'bottom-left'.

Examples

notify.error('Wrong file format')
notify.info('Wrong file format')
notify.success('Wrong file format')
notify.warn('Wrong file format')
notify.custom(
  <h1 style={{ background: 'black', color: 'white' }}>Wrong file format !</h1>,
)

If it is necessary to change the size of the alert and its positioning

notify.error('Wrong file format', {
  size: 'l',
  position: 'top-center',
  // pass any props from this page https://fkhadra.github.io/react-toastify/api/toast/
})

You can override the properties for the alert component

1 way

notify.error('Wrong file format', { alertProps: { clear: true } })

2 way

notify.custom(
  <AlertComponent clear type="error">
    Wrong file format
  </AlertComponent>,
)
1.2.0

12 months ago

1.1.0

1 year ago

1.0.6

1 year ago

1.0.7-alpha.0

1 year ago

1.0.6-alpha.0

1 year ago

1.0.5

1 year ago

1.0.5-alpha.0

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.0-dev.6

2 years ago

1.0.0-dev.5

2 years ago

1.0.0-dev.4

2 years ago

1.0.0-dev.3

2 years ago

1.0.0-dev.2

2 years ago

1.0.0-dev.1

2 years ago

1.0.0-dev.0

2 years ago