From 0abf69bcf0ac97b42ab6cb0e09d6769c72fc68dd Mon Sep 17 00:00:00 2001 From: joshLumpkin <112642855+joshLumpkin@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:18:35 -0500 Subject: [PATCH 1/3] Changed Toast init to notify --- .../page-config/ui-elements/toast/code/composition-api.js | 4 ++-- .../docs/page-config/ui-elements/toast/code/options-api.js | 2 +- packages/ui/src/components/va-toast/hooks/useToast.ts | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/docs/page-config/ui-elements/toast/code/composition-api.js b/packages/docs/page-config/ui-elements/toast/code/composition-api.js index d88972d099..d150195b2e 100644 --- a/packages/docs/page-config/ui-elements/toast/code/composition-api.js +++ b/packages/docs/page-config/ui-elements/toast/code/composition-api.js @@ -2,10 +2,10 @@ import { useToast } from 'vuestic-ui' export default defineComponent({ setup() { - const { init, close, closeAll } = useToast() + const { init, notify, close, closeAll } = useToast() return { - onButtonClick: () => init('Toast example!'), + onButtonClick: () => notify('Toast example!'), } } }) \ No newline at end of file diff --git a/packages/docs/page-config/ui-elements/toast/code/options-api.js b/packages/docs/page-config/ui-elements/toast/code/options-api.js index 2741ae79ce..67c6196551 100644 --- a/packages/docs/page-config/ui-elements/toast/code/options-api.js +++ b/packages/docs/page-config/ui-elements/toast/code/options-api.js @@ -1,7 +1,7 @@ export default { methods: { onButtonClick() { - this.$vaToast.init('Toast example!') + this.$vaToast.notify('Toast example!') }, }, diff --git a/packages/ui/src/components/va-toast/hooks/useToast.ts b/packages/ui/src/components/va-toast/hooks/useToast.ts index b943806caf..c9c00aff4a 100644 --- a/packages/ui/src/components/va-toast/hooks/useToast.ts +++ b/packages/ui/src/components/va-toast/hooks/useToast.ts @@ -9,6 +9,7 @@ export const useToast = () => { /** * @param options can be options object or message string + * @deprecated Use notify instead */ const init = (options: string | NotificationOptions) => { const id = createToastInstance(options, appContext.value) @@ -18,6 +19,10 @@ export const useToast = () => { return id } + const notify = (options: string | NotificationOptions) => { + return init(options) + } + const close = (id: string) => closeById(id) /** @@ -32,6 +37,6 @@ export const useToast = () => { } return { - init, close, closeAll, closeAllCreatedInThisHook, + init, notify, close, closeAll, closeAllCreatedInThisHook, } } From e6c680526ac58d1202020cd02ea850e217473057 Mon Sep 17 00:00:00 2001 From: joshLumpkin <112642855+joshLumpkin@users.noreply.github.com> Date: Fri, 24 Nov 2023 13:16:04 -0500 Subject: [PATCH 2/3] Update useToast.ts --- packages/ui/src/components/va-toast/hooks/useToast.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/ui/src/components/va-toast/hooks/useToast.ts b/packages/ui/src/components/va-toast/hooks/useToast.ts index c9c00aff4a..83ac3ed067 100644 --- a/packages/ui/src/components/va-toast/hooks/useToast.ts +++ b/packages/ui/src/components/va-toast/hooks/useToast.ts @@ -9,9 +9,8 @@ export const useToast = () => { /** * @param options can be options object or message string - * @deprecated Use notify instead */ - const init = (options: string | NotificationOptions) => { + const notify = (options: string | NotificationOptions) => { const id = createToastInstance(options, appContext.value) if (id) { createdInThisSetupContext.push(id) } @@ -19,8 +18,11 @@ export const useToast = () => { return id } - const notify = (options: string | NotificationOptions) => { - return init(options) +/** + * @deprecated Use notify instead +*/ + const init = (options: string | NotificationOptions) => { + return notify(options) } const close = (id: string) => closeById(id) From f5189dfebb67ec5af120b11e8f3d9bca8f8f8fb1 Mon Sep 17 00:00:00 2001 From: Maksim Nedoshev Date: Sun, 26 Nov 2023 12:36:35 +0200 Subject: [PATCH 3/3] chore: minor formatting --- packages/ui/src/components/va-toast/hooks/useToast.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ui/src/components/va-toast/hooks/useToast.ts b/packages/ui/src/components/va-toast/hooks/useToast.ts index 83ac3ed067..79aa04041c 100644 --- a/packages/ui/src/components/va-toast/hooks/useToast.ts +++ b/packages/ui/src/components/va-toast/hooks/useToast.ts @@ -18,9 +18,9 @@ export const useToast = () => { return id } -/** - * @deprecated Use notify instead -*/ + /** + * @deprecated Use `notify` instead + */ const init = (options: string | NotificationOptions) => { return notify(options) }