Skip to content

Commit

Permalink
Merge pull request #268 from marceloatg/feature/update-modal
Browse files Browse the repository at this point in the history
Added modal attribute binding
  • Loading branch information
gustavomg12 authored Jul 30, 2024
2 parents a353d1c + 9742102 commit a8c1754
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/components/slds-modal/slds-modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<!-- Modal -->
<transition appear :name="transitionName">
<section tabindex="-1" :class="modalClassNames">
<section tabindex="-1" :class="modalClassNames" v-bind="modalAttributes">
<div class="slds-modal__container">

<!-- Header -->
Expand Down Expand Up @@ -84,10 +84,18 @@ export default defineComponent({
computed: {
/**
* Transition name, if any.
* Bindable modal attributes.
*/
transitionName(): string {
return this.noAnimation ? "" : "blow-up"
modalAttributes(): Record<string, unknown> {
const attributes: Record<string, unknown> = {}
for (const attribute in this.$attrs) {
if (attribute.startsWith("data-") || attribute === "class") {
attributes[attribute] = this.$attrs[attribute]
}
}
return attributes
},
/**
Expand Down Expand Up @@ -139,6 +147,13 @@ export default defineComponent({
return classNames
},
/**
* Transition name, if any.
*/
transitionName(): string {
return this.noAnimation ? "" : "blow-up"
},
},
mounted() {
Expand Down

0 comments on commit a8c1754

Please sign in to comment.