Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toasts prop on the Toast provider component #9

Open
nsantos16 opened this issue Aug 13, 2020 · 1 comment
Open

Toasts prop on the Toast provider component #9

nsantos16 opened this issue Aug 13, 2020 · 1 comment
Labels
enhancement New feature or request hacktoberfest on hold Toast behavior Related with the implementation of toast behavior V0.1 release Will be included in V0.1 release

Comments

@nsantos16
Copy link
Contributor

Description

In order to increase the scalability and the dev experience using the library, we need to add a prop calling toasts to the ToastProvider component, this prop allows our users to implement in the provider an easy way of calling different types of Toast components, only calling by their key name assigned in the toasts object which has as a value the custom component.

Expected Behavior

As an example of the expected behavior, we have toastsComponents objects declared in this way

const toastsComponents = {'success': <ToastSuccess />, 'error': <ToastError />};

The ToastsProvider receive the prop according to this

<ToastProvider toasts={toastsComponents}>
  <App />
<ToastProvider />

And when the hook useToast receive on of the keys declared on toastsComponents, then acts the same way it would if you were passing a component param

// Same as useToast(<ToastSuccess />)
const { onClose , onOpen } = useToast('success');
@nsantos16 nsantos16 added enhancement New feature or request V0.1 release Will be included in V0.1 release on hold Toast behavior Related with the implementation of toast behavior labels Aug 13, 2020
@nsantos16 nsantos16 added this to Backlog in Public backlog via automation Aug 13, 2020
@peter7z
Copy link

peter7z commented Aug 17, 2020

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest on hold Toast behavior Related with the implementation of toast behavior V0.1 release Will be included in V0.1 release
Projects
Public backlog
  
Backlog
Development

No branches or pull requests

2 participants