This repository has been archived by the owner on Jun 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/35: componente notificador (#47)
Signed-off-by: GitHub <[email protected]> Co-authored-by: Fernando Fernández <[email protected]>
- Loading branch information
1 parent
f3a75b8
commit 51a0658
Showing
6 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
{} | ||
{ | ||
"¡Notificación Exitosa!" : "Success Notification!", | ||
"¡Notificación de Errónea!" : "Error Notification!", | ||
"¡Notificación de Advertencia!" : "Warning Notification!", | ||
"¡Notificación de Información!" : "Info Notification!", | ||
"Notificación" : "Notification" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
{} | ||
{ | ||
"¡Notificación Exitosa!" : "¡Notificación Exitosa!", | ||
"¡Notificación de Errónea!" : "¡Notificación de Errónea!", | ||
"¡Notificación de Advertencia!" : "¡Notificación de Advertencia!", | ||
"¡Notificación de Información!" : "¡Notificación de Información!", | ||
"Notificación" : "Notificación" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { toast } from 'vue3-toastify'; | ||
import { i18n } from '@/plugins/i18n'; | ||
|
||
type NotificationTypes = 'warning' | 'success' | 'error' | 'info'; | ||
|
||
/** | ||
* Muestra una notificación en la aplicación | ||
*/ | ||
export function useToast(message?: string, type?: NotificationTypes): void { | ||
const { t } = i18n; | ||
|
||
switch (type) { | ||
case 'success': { | ||
toast.success(message ?? t('¡Notificación Exitosa!') , { | ||
position: toast.POSITION.TOP_CENTER | ||
}); | ||
break; | ||
} | ||
case 'error': { | ||
toast.error(message ?? t('¡Notificación de Errónea!'), { | ||
position: toast.POSITION.TOP_LEFT | ||
}); | ||
break; | ||
} | ||
case 'warning': { | ||
toast.warn(message ?? t('¡Notificación de Advertencia!'), { | ||
position: toast.POSITION.BOTTOM_LEFT | ||
}); | ||
break; | ||
} | ||
case 'info': { | ||
toast.info(message ?? t('¡Notificación de Información!'), { | ||
position: toast.POSITION.BOTTOM_CENTER | ||
}); | ||
break; | ||
} | ||
default: { | ||
toast(message ?? t('Notificación'), { | ||
position: toast.POSITION.BOTTOM_RIGHT | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters