Skip to content

Commit

Permalink
ESLint: fix code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell authored and github-actions[bot] committed Nov 8, 2024
1 parent f9804ba commit d611102
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 46 deletions.
65 changes: 42 additions & 23 deletions stubs/inertia-vue-ts/resources/js/Components/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,24 @@ const emit = defineEmits(['close']);
const dialog = ref();
const showSlot = ref(props.show);
watch(() => props.show, () => {
if (props.show) {
document.body.style.overflow = 'hidden';
showSlot.value = true;
watch(
() => props.show,
() => {
if (props.show) {
document.body.style.overflow = 'hidden';
showSlot.value = true;
dialog.value?.showModal();
} else {
document.body.style.overflow = '';
dialog.value?.showModal();
} else {
document.body.style.overflow = '';
setTimeout(() => {
dialog.value?.close();
showSlot.value = false;
}, 200);
}
});
setTimeout(() => {
dialog.value?.close();
showSlot.value = false;
}, 200);
}
},
);
const close = () => {
if (props.closeable) {
Expand Down Expand Up @@ -60,18 +63,24 @@ onUnmounted(() => {
const maxWidthClass = computed(() => {
return {
'sm': 'sm:max-w-sm',
'md': 'sm:max-w-md',
'lg': 'sm:max-w-lg',
'xl': 'sm:max-w-xl',
sm: 'sm:max-w-sm',
md: 'sm:max-w-md',
lg: 'sm:max-w-lg',
xl: 'sm:max-w-xl',
'2xl': 'sm:max-w-2xl',
}[props.maxWidth];
});
</script>

<template>
<dialog class="z-50 m-0 min-h-full min-w-full overflow-y-auto bg-transparent backdrop:bg-transparent" ref="dialog">
<div class="fixed inset-0 overflow-y-auto px-4 py-6 sm:px-0 z-50" scroll-region>
<dialog
class="z-50 m-0 min-h-full min-w-full overflow-y-auto bg-transparent backdrop:bg-transparent"
ref="dialog"
>
<div
class="fixed inset-0 z-50 overflow-y-auto px-4 py-6 sm:px-0"
scroll-region
>
<Transition
enter-active-class="ease-out duration-300"
enter-from-class="opacity-0"
Expand All @@ -80,8 +89,14 @@ const maxWidthClass = computed(() => {
leave-from-class="opacity-100"
leave-to-class="opacity-0"
>
<div v-show="show" class="fixed inset-0 transform transition-all" @click="close">
<div class="absolute inset-0 bg-gray-500 dark:bg-gray-900 opacity-75" />
<div
v-show="show"
class="fixed inset-0 transform transition-all"
@click="close"
>
<div
class="absolute inset-0 bg-gray-500 opacity-75 dark:bg-gray-900"
/>
</div>
</Transition>

Expand All @@ -93,8 +108,12 @@ const maxWidthClass = computed(() => {
leave-from-class="opacity-100 translate-y-0 sm:scale-100"
leave-to-class="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<div v-show="show" class="mb-6 bg-white dark:bg-gray-800 rounded-lg overflow-hidden shadow-xl transform transition-all sm:w-full sm:mx-auto" :class="maxWidthClass">
<slot v-if="showSlot"/>
<div
v-show="show"
class="mb-6 transform overflow-hidden rounded-lg bg-white shadow-xl transition-all sm:mx-auto sm:w-full dark:bg-gray-800"
:class="maxWidthClass"
>
<slot v-if="showSlot" />
</div>
</Transition>
</div>
Expand Down
65 changes: 42 additions & 23 deletions stubs/inertia-vue/resources/js/Components/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,24 @@ const emit = defineEmits(['close']);
const dialog = ref();
const showSlot = ref(props.show);
watch(() => props.show, () => {
if (props.show) {
document.body.style.overflow = 'hidden';
showSlot.value = true;
watch(
() => props.show,
() => {
if (props.show) {
document.body.style.overflow = 'hidden';
showSlot.value = true;
dialog.value?.showModal();
} else {
document.body.style.overflow = '';
dialog.value?.showModal();
} else {
document.body.style.overflow = '';
setTimeout(() => {
dialog.value?.close();
showSlot.value = false;
}, 200);
}
});
setTimeout(() => {
dialog.value?.close();
showSlot.value = false;
}, 200);
}
},
);
const close = () => {
if (props.closeable) {
Expand Down Expand Up @@ -62,18 +65,24 @@ onUnmounted(() => {
const maxWidthClass = computed(() => {
return {
'sm': 'sm:max-w-sm',
'md': 'sm:max-w-md',
'lg': 'sm:max-w-lg',
'xl': 'sm:max-w-xl',
sm: 'sm:max-w-sm',
md: 'sm:max-w-md',
lg: 'sm:max-w-lg',
xl: 'sm:max-w-xl',
'2xl': 'sm:max-w-2xl',
}[props.maxWidth];
});
</script>
<template>
<dialog class="z-50 m-0 min-h-full min-w-full overflow-y-auto bg-transparent backdrop:bg-transparent" ref="dialog">
<div class="fixed inset-0 overflow-y-auto px-4 py-6 sm:px-0 z-50" scroll-region>
<dialog
class="z-50 m-0 min-h-full min-w-full overflow-y-auto bg-transparent backdrop:bg-transparent"
ref="dialog"
>
<div
class="fixed inset-0 z-50 overflow-y-auto px-4 py-6 sm:px-0"
scroll-region
>
<Transition
enter-active-class="ease-out duration-300"
enter-from-class="opacity-0"
Expand All @@ -82,8 +91,14 @@ const maxWidthClass = computed(() => {
leave-from-class="opacity-100"
leave-to-class="opacity-0"
>
<div v-show="show" class="fixed inset-0 transform transition-all" @click="close">
<div class="absolute inset-0 bg-gray-500 dark:bg-gray-900 opacity-75" />
<div
v-show="show"
class="fixed inset-0 transform transition-all"
@click="close"
>
<div
class="absolute inset-0 bg-gray-500 opacity-75 dark:bg-gray-900"
/>
</div>
</Transition>
Expand All @@ -95,8 +110,12 @@ const maxWidthClass = computed(() => {
leave-from-class="opacity-100 translate-y-0 sm:scale-100"
leave-to-class="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<div v-show="show" class="mb-6 bg-white dark:bg-gray-800 rounded-lg overflow-hidden shadow-xl transform transition-all sm:w-full sm:mx-auto" :class="maxWidthClass">
<slot v-if="showSlot"/>
<div
v-show="show"
class="mb-6 transform overflow-hidden rounded-lg bg-white shadow-xl transition-all sm:mx-auto sm:w-full dark:bg-gray-800"
:class="maxWidthClass"
>
<slot v-if="showSlot" />
</div>
</Transition>
</div>
Expand Down

0 comments on commit d611102

Please sign in to comment.