Skip to content

Commit

Permalink
fix(Modal): widthClass prop and default preset value (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
smarroufin committed May 9, 2022
1 parent 23deef3 commit d980176
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 6 additions & 9 deletions src/runtime/components/overlays/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ const props = defineProps({
},
widthClass: {
type: String,
default: () => $ui.modal.width,
validator (value: string) {
return ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', '7xl'].map(width => `max-w-${width}`).includes(value)
}
default: () => $ui.modal.width
}
})
Expand All @@ -112,11 +109,11 @@ const isOpen = computed({
const modalClass = computed(() => {
return classNames(
props.baseClass,
`sm:${props.widthClass}`,
props.backgroundClass,
props.shadowClass,
props.ringClass,
props.roundedClass
props.widthClass,
props.backgroundClass,
props.shadowClass,
props.ringClass,
props.roundedClass
)
})
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/presets/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ const modal = {
ring: '',
rounded: 'rounded-lg',
shadow: 'shadow-xl',
width: 'max-w-lg'
width: 'sm:max-w-lg'
}

const container = {
Expand Down

0 comments on commit d980176

Please sign in to comment.