Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add closeButtonTitle props to modal components #995

Merged
merged 2 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/components/src/components/modal/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export class Modal {
@Prop() duration?: number = 200;
/** (optional) Label for close button */
@Prop() closeButtonLabel?: string = 'Close Pop-up';
/** (optional) title for close button */
@Prop() closeButtonTitle?: string = 'Close';
/** (optional) Alignment of action buttons */
@Prop() alignActions?: 'right' | 'left' = 'right';
/** (optional) Injected CSS styles */
Expand Down Expand Up @@ -267,6 +269,7 @@ export class Modal {
part="close-button"
onClick={() => this.emitBeforeClose('CLOSE_BUTTON')}
aria-label={this.closeButtonLabel}
title={this.closeButtonTitle}
>
<slot name="close-icon">
<scale-icon-action-circle-close decorative />
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/components/modal/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
| ------------------ | -------------------- | ---------------------------------------- | ------------------- | ---------------- |
| `alignActions` | `align-actions` | (optional) Alignment of action buttons | `"left" \| "right"` | `'right'` |
| `closeButtonLabel` | `close-button-label` | (optional) Label for close button | `string` | `'Close Pop-up'` |
| `closeButtonTitle` | `close-button-title` | (optional) title for close button | `string` | `'Close'` |
| `customClass` | `custom-class` | (optional) Custom class | `string` | `''` |
| `duration` | `duration` | (optional) Transition duration | `number` | `200` |
| `heading` | `heading` | Modal heading | `string` | `undefined` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const Template = (args, context) => ({
:opened="isOpen"
:duration="duration"
:close-button-label="closeButtonLabel"
:close-button-title="closeButtonTitle"
:align-actions="alignActions"
:styles="styles"
@scaleClose="scaleClose()"
Expand Down
30 changes: 16 additions & 14 deletions packages/storybook-vue/stories/components/modal/ScaleModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:opened="opened"
:duration="duration"
:close-button-label="closeButtonLabel"
:close-button-title="closeButtonTitle"
:align-actions="alignActions"
:styles="styles"
@scaleClose="scaleClose"
Expand All @@ -20,7 +21,7 @@
</template>

<script>
import { action } from "@storybook/addon-actions";
import { action } from '@storybook/addon-actions';

const scaleCloseAction = action('scaleClose');

Expand All @@ -33,34 +34,35 @@ export default {
opened: Boolean,
duration: { type: Number, default: 200 },
closeButtonLabel: String,
closeButtonTitle: String,
alignActions: { type: String, default: 'right' },
styles: { type: String },
},
methods: {
scaleOpen($event) {
action("scaleOpen");
this.$emit("scaleOpen", $event);
action('scaleOpen');
this.$emit('scaleOpen', $event);
},
'scale-open'($event) {
action("scale-open");
this.$emit("scale-open", $event);
action('scale-open');
this.$emit('scale-open', $event);
},
scaleBeforeClose($event) {
action("scaleBeforeClose");
this.$emit("scaleBeforeClose", $event);
action('scaleBeforeClose');
this.$emit('scaleBeforeClose', $event);
},
'scale-before-close'($event) {
action("scale-before-close");
this.$emit("scale-before-close", $event);
action('scale-before-close');
this.$emit('scale-before-close', $event);
},
scaleClose($event) {
action("scaleClose");
this.$emit("scaleClose", $event);
action('scaleClose');
this.$emit('scaleClose', $event);
},
'scale-close'($event) {
action("scale-close");
this.$emit("scale-close", $event);
action('scale-close');
this.$emit('scale-close', $event);
},
}
},
};
</script>