react-haiku
react-haiku copied to clipboard
[FEAT] Add useNotification hook
Description To add a hook that allows usage of the built in notification system: mozilla
Acceptance Criteria
- [ ] Allows for title input
- [ ] Allows for description input
- [ ] Allows for image input
- [ ] Needs to check permissions with
Notification.permission
- [ ] All other notification properties, specified on mozilla docs.
- [ ] Returns the events from the notification (close, click, error, show, etc.)
Example usage
import { useNotification } from "react-haiku";
//... component
const { show, close } = useNotification({
title: "Test Notification",
//... more properties here
});
//... in button for example:
onClick={() => {
show();
}}
//... close component
the hook will either show the notification or not at all if the permission is denied.
We could also return the permission status: 'denied' | 'granted' | 'loading' | 'default'