Skip to content

Commit

Permalink
fix(BaseDialog): chagne size prop
Browse files Browse the repository at this point in the history
use interface instead validator for fix build errors
  • Loading branch information
rudnovd committed Jan 10, 2022
1 parent 45fc2e5 commit 31950db
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/components/base/BaseDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<transition name="transition-dialog">
<teleport to="body">
<div v-if="show" class="dialog-area" role="dialog">
<div ref="baseDialog" class="base-dialog" :class="`base-dialog-${size}`">
<div ref="baseDialogRef" class="base-dialog" :class="`base-dialog-${size}`">
<div class="modal-content">
<div class="header">
<slot name="header"></slot>
Expand All @@ -18,9 +18,11 @@
</template>

<script lang="ts">
import { defineComponent, ref, onMounted, onUnmounted } from 'vue'
import CloseButton from '@/components/buttons/CloseButton.vue'
import { onClickOutside } from '@vueuse/core'
import { defineComponent, onMounted, onUnmounted, ref } from 'vue'
type BaseDialogSizesProp = 'small' | 'medium' | 'large' | 'maximum'
export default defineComponent({
name: 'BaseDialog',
Expand All @@ -33,18 +35,15 @@ export default defineComponent({
required: true,
},
size: {
type: String,
type: String as () => BaseDialogSizesProp,
default: 'medium',
validator(size: string) {
return ['small', 'medium', 'large', 'extra-large', 'maximum'].includes(size)
},
},
},
emits: ['close'],
setup(props, context) {
const baseDialog = ref(null)
const baseDialogRef = ref(null)
onClickOutside(baseDialog, () => context.emit('close'))
onClickOutside(baseDialogRef, () => context.emit('close'))
onMounted(() => {
const scrollbarWidth = window.innerWidth - document.body.clientWidth
Expand All @@ -59,7 +58,9 @@ export default defineComponent({
}, 200)
})
return { baseDialog }
return {
baseDialogRef,
}
},
})
</script>
Expand Down

0 comments on commit 31950db

Please sign in to comment.