question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ship useNotification hook

See original GitHub issue

We offer a variety of notification styles but unfortunately leave much of the animation and logic around display notifications to the end-user. We would like to codify this behavior/logic into a single hook, useNotification, that would encapsulate this behavior and make it easier for product teams to display/render notifications in their UI. This may look like:

function MyComponent() {
  const send = useNotification();

  function sendNotification() {
    send({ title: 'This is the notification title' });
  }

  return <button type="button" onClick={sendNotification}>Send test notification</button>;
}

Packages impacted

  • @carbon/react

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
johnbistercommented, Jun 4, 2021

Here’s a rough pass on how multiple inline notifications could stack and be dismissed. I kept it simple for now to make sure we like the overall mechanics.

@mjabbink @jeanservaas @tay1orjones Let me know if you have any feedback I should take into the next pass. Thanks!

https://user-images.githubusercontent.com/70543333/120850559-752c4300-c52c-11eb-9606-de8e26c54cbf.mp4

1reaction
mjabbinkcommented, Jun 11, 2021

@johnbister

I like the updates you’ve done. I think the fade gradient can work and wonder what @jeanservaas thinks on the details of the gradient?

I like the addition of a taller notification in the stack to see what that looks like

I also think timeout bar is cool.

Read more comments on GitHub >

github_iconTop Results From Across the Web

useNotification hook #15 - carbon-design-system/roadmap
We would like to codify this behavior/logic into a single hook, ... Ship and document a React hook to send notifications to a...
Read more >
react-notifications-hook - npm
Easily create your own notification system in your React app without having to buy into prescribed styling or templating.
Read more >
React hooks & Context: Error when using context inside a ...
React Hook useEffect has a missing dependency: 'itemContext.actions'. Either include it or remove the dependency array ...
Read more >
Power Real-Time Tracking Notifications with Webhooks ...
Use tracking webhooks to gather real-time data that can help influence decisions about your shipping workflow in real-time. Want to improve your ...
Read more >
Building a reusable notification system with react hooks and ...
The problem While building a re-usable component we tend to forget what are the essential... Tagged with react, javascript, reactnotifier, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found