From 9bb480d6205ba9f92307cc3ef5e0467a88a6eb7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Fri, 10 Mar 2023 23:27:15 +0100 Subject: [PATCH] updated docs --- .../libs/modal/stories/modal.mdx | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/libs/modal/stories/modal.mdx b/src/Umbraco.Web.UI.Client/libs/modal/stories/modal.mdx index 69baf76f73..9cb19bc473 100644 --- a/src/Umbraco.Web.UI.Client/libs/modal/stories/modal.mdx +++ b/src/Umbraco.Web.UI.Client/libs/modal/stories/modal.mdx @@ -100,7 +100,11 @@ interface MyModalData = { content: string; } -const MY_MODAL_TOKEN = new ModalToken('My.Modal', { +interface MyModalResult = { + myReturnData: string; +} + +const MY_MODAL_TOKEN = new ModalToken('My.Modal', { type: 'sidebar', size: 'small' }); @@ -116,19 +120,24 @@ import type { UmbModalHandler } from '@umbraco-cms/modal'; class MyDialog extends UmbElementMixin(LitElement) { // the modal handler will be injected into the element when the modal is opened. @property({ attribute: false }) - modalHandler?: UmbModalHandler; + modalHandler?: UmbModalHandler; - private _handleClose() { - /* Optional data of any type can be applied to the close method to pass it - to the modal parent through the onClose promise. */ - this._modalHandler?.close('optional data'); + private _handleCancel() { + this._modalHandler?.close(); + } + + private _handleSubmit() { + /* Optional data of any type can be applied to the submit method to pass it + to the modal parent through the onSubmit promise. */ + this._modalHandler?.submit({ myReturnData: 'hello world' }); } render() { return html`

My Modal

- + +
`; }