From 9e01091de8b9c0b90d76a1a9203d130f81ba7d67 Mon Sep 17 00:00:00 2001 From: AndreiaPena Date: Tue, 24 Sep 2024 16:40:59 +0200 Subject: [PATCH] Todo --- addon/components/pix-toast-container.hbs | 8 ++++++ addon/components/pix-toast-container.js | 6 +++++ addon/components/pix-toast.hbs | 7 ++---- addon/components/pix-toast.js | 18 ++++++++------ addon/services/pix-toast.js | 23 +++++++----------- addon/styles/_pix-toast.scss | 16 ++++++------ app/components/pix-toast-container.js | 1 + app/stories/pix-toast.stories.js | 31 +++++------------------- 8 files changed, 50 insertions(+), 60 deletions(-) create mode 100644 addon/components/pix-toast-container.hbs create mode 100644 addon/components/pix-toast-container.js create mode 100644 app/components/pix-toast-container.js diff --git a/addon/components/pix-toast-container.hbs b/addon/components/pix-toast-container.hbs new file mode 100644 index 000000000..dd4df35f9 --- /dev/null +++ b/addon/components/pix-toast-container.hbs @@ -0,0 +1,8 @@ +
+ {{#if this.pixToast}} + + {{/if}} +
\ No newline at end of file diff --git a/addon/components/pix-toast-container.js b/addon/components/pix-toast-container.js new file mode 100644 index 000000000..6ea4a5490 --- /dev/null +++ b/addon/components/pix-toast-container.js @@ -0,0 +1,6 @@ +import Component from '@glimmer/component'; +import { service } from '@ember/service'; + +export default class PixToastContainer extends Component { + @service pixToast; +} diff --git a/addon/components/pix-toast.hbs b/addon/components/pix-toast.hbs index fc094eecf..ac01771f6 100644 --- a/addon/components/pix-toast.hbs +++ b/addon/components/pix-toast.hbs @@ -1,12 +1,9 @@ -
+

- {{yield}} + {{@message}}

({ template: hbs` - ed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, - totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae - dicta sunt explicabo. -`, +/>`, context: args, }), argTypes: { @@ -21,16 +16,6 @@ export default { description: 'Type de la notification : success, error, information, warning', type: { name: 'string', required: true }, }, - onCloseButtonClick: { - name: 'onCloseButtonClick', - description: 'Fonction à exécuter à la fermeture de la notification', - type: { name: 'function', required: true }, - }, - showToast: { - name: 'showToast', - description: "Gérer l'affichage de la notification", - type: { name: 'boolean', required: true }, - }, ariaLabelForCloseButton: { name: 'ariaLabelForCloseButton', description: 'Aria-label pour le bouton de fermeture de la notification', @@ -42,34 +27,30 @@ export default { export const success = { args: { type: 'success', - showToast: true, + message: "ed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium,\n totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae\n dicta sunt explicabo.", ariaLabelForCloseButton: 'Fermer', - onCloseButtonClick: () => {}, }, }; export const error = { args: { type: 'error', - showToast: true, + message: "ed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium,\n totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae\n dicta sunt explicabo.", ariaLabelForCloseButton: 'Fermer', - onCloseButtonClick: () => {}, }, }; export const information = { args: { type: 'information', - showToast: true, + message: "ed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium,\n totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae\n dicta sunt explicabo.", ariaLabelForCloseButton: 'Fermer', - onCloseButtonClick: () => {}, }, }; export const warning = { args: { type: 'warning', - showToast: true, + message: "ed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium,\n totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae\n dicta sunt explicabo.", ariaLabelForCloseButton: 'Fermer', - onCloseButtonClick: () => {}, }, };