From 6737f8e5912de893d706dd128755c2c364726f4a Mon Sep 17 00:00:00 2001 From: Maomao Meyer-Zhang Date: Wed, 7 Sep 2022 13:03:04 +0200 Subject: [PATCH 1/5] fix: add displayCloseButton prop, update storybook --- .../components/src/components/modal/modal.tsx | 28 +++++++++++-------- .../components/src/components/modal/readme.md | 1 + .../components/modal/Modal.stories.mdx | 16 ++++++++--- .../stories/components/modal/ScaleModal.vue | 2 ++ 4 files changed, 31 insertions(+), 16 deletions(-) diff --git a/packages/components/src/components/modal/modal.tsx b/packages/components/src/components/modal/modal.tsx index 287b49d135..905387cb7d 100644 --- a/packages/components/src/components/modal/modal.tsx +++ b/packages/components/src/components/modal/modal.tsx @@ -59,6 +59,8 @@ export class Modal { @Prop() closeButtonLabel?: string = 'Close Pop-up'; /** (optional) title for close button */ @Prop() closeButtonTitle?: string = 'Close'; + /** (optional) display close button */ + @Prop() displayCloseButton?: boolean = true; /** (optional) Alignment of action buttons */ @Prop() alignActions?: 'right' | 'left' = 'right'; /** (optional) Injected CSS styles */ @@ -274,18 +276,20 @@ export class Modal { - + {this.displayCloseButton && ( + + )}
(this.modalBody = el)} diff --git a/packages/components/src/components/modal/readme.md b/packages/components/src/components/modal/readme.md index a024dcd6a5..1fef129252 100644 --- a/packages/components/src/components/modal/readme.md +++ b/packages/components/src/components/modal/readme.md @@ -13,6 +13,7 @@ | `allowInjectingStyleToBody` | `allow-injecting-style-to-body` | (optional) allow to inject css style {overflow: hidden} to body when modal is open | `boolean` | `false` | | `closeButtonLabel` | `close-button-label` | (optional) Label for close button | `string` | `'Close Pop-up'` | | `closeButtonTitle` | `close-button-title` | (optional) title for close button | `string` | `'Close'` | +| `displayCloseButton` | `display-close-button` | (optional) display close button | `boolean` | `true` | | `duration` | `duration` | (optional) Transition duration | `number` | `200` | | `heading` | `heading` | Modal heading | `string` | `undefined` | | `opened` | `opened` | (optional) If `true`, the Modal is open. | `boolean` | `false` | diff --git a/packages/storybook-vue/stories/components/modal/Modal.stories.mdx b/packages/storybook-vue/stories/components/modal/Modal.stories.mdx index 024c506b4d..1940260404 100644 --- a/packages/storybook-vue/stories/components/modal/Modal.stories.mdx +++ b/packages/storybook-vue/stories/components/modal/Modal.stories.mdx @@ -43,6 +43,13 @@ import ScaleModal from './ScaleModal.vue'; disable: true, }, }, + scaleBeforeClose: { + description: '@deprecated in v3 in favor of kebab-case event names.', + }, + 'scale-before-close': { + description: + 'It fires on every close attempt. Calling `event.preventDefault()` will prevent the modal from closing.', + }, }} /> @@ -74,6 +81,7 @@ export const Template = (args, context) => ({ :duration="duration" :close-button-label="closeButtonLabel" :close-button-title="closeButtonTitle" + :display-close-button="displayCloseButton" :align-actions="alignActions" :styles="styles" :allow-injecting-style-to-body="allowInjectingStyleToBody" @@ -140,10 +148,10 @@ export const Template = (args, context) => ({ ```html

Hello. Welcome. What a pleasure it is to have you.

- + Cancel - Primary Action + Primary Action