Skip to content

Commit

Permalink
fix(maz-ui): MazDialog - add padding on the bottom to the content whe…
Browse files Browse the repository at this point in the history
…n no footer
  • Loading branch information
LouisMazel committed Nov 29, 2024
1 parent 784541a commit edd3113
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions packages/lib/components/MazDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
nextTick,
ref,
useAttrs,
useSlots,
watch,
} from 'vue'
import MazBackdrop, { type MazBackdropProps } from './MazBackdrop.vue'
Expand Down Expand Up @@ -102,6 +103,9 @@ const wrapperAttrs = computed<{
const dialogContent = ref<HTMLElement>()
const slots = useSlots()
const hasFooter = computed(() => !!slots.footer)
if (props.scrollable) {
watch(() => props.modelValue, async (newVal) => {
await nextTick()
Expand Down Expand Up @@ -167,15 +171,15 @@ if (props.scrollable) {
/>
</div>
</slot>
<div id="dialogDesc" ref="dialogContent" class="m-dialog-content">
<div id="dialogDesc" ref="dialogContent" class="m-dialog-content" :class="{ '--bottom-padding': !hasFooter }">
<!--
@slot Default content
@binding {Function} close close function
@binding {Function} onBackdropClicked onBackdropClicked function (respects persistent option)
-->
<slot :close :on-backdrop-clicked />
</div>
<div v-if="$slots.footer" class="m-dialog-footer">
<div v-if="hasFooter" class="m-dialog-footer">
<!--
@slot Footer slot
@binding {Function} close close function
Expand Down Expand Up @@ -218,13 +222,21 @@ if (props.scrollable) {
&-icon {
flex: 0 0 auto;
}
& .--bottom-padding {
@apply maz-pb-4;
}
}
&.--scrollable {
@apply maz-max-h-[95vh] maz-my-0;
.m-dialog-content {
@apply maz-overflow-auto maz-border-y maz-border-color-light maz-py-4;
@apply maz-overflow-auto maz-border-t maz-border-color-light maz-py-4;
&:not(.--bottom-padding) {
@apply maz-border-b;
}
}
}
}
Expand Down

0 comments on commit edd3113

Please sign in to comment.