0.1.8-alpha • Published 2 years ago
modal-toast v0.1.8-alpha
Modal Toast
Instalação do modal toast.
npm i modal-toast
Importação do pacote.
import NotifyContent, { notify } from 'modal-toast';
Adicione o NotifyContent dentro do seu componente principal, exemplo:
function App(){
return(
<>
<NotifyContent />
<div class="App>
...
</div>
</>
)
}
Utilizando a chamada do modal:
function handleModalDark() {
notify.show({
title: "Titulo",
text:"Mensagem de texto",
type: "danger",
type: "danger",
schema: "dark"
});
}
function handleModalLight() {
notify.show({
title: "Titulo",
text:"Mensagem de texto",
type: "danger",
type: "danger",
schema: "light"
});
}
Fechando um modal
notify.hide();
Criando uma interação fetch
function handleModalLight() {
notify.show({
title: "Titulo",
text:"Mensagem de texto",
type: "danger",
schema: "light",
onProcess: () => {
console.log("Executando seu processo aqui")
},
onProcessName: "Nome a ser exibido no botão"
});
}