mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-02-02 05:08:03 +01:00
chore: improve Modal / Slideover preset
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<TransitionRoot :appear="appear" :show="isOpen" as="template">
|
<TransitionRoot :appear="appear" :show="isOpen" as="template">
|
||||||
<Dialog class="relative z-50" @close="close">
|
<Dialog :class="wrapperClass" @close="close">
|
||||||
<TransitionChild
|
<TransitionChild
|
||||||
v-if="overlay"
|
v-if="overlay"
|
||||||
as="template"
|
as="template"
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<div class="fixed inset-0 transition-opacity" :class="overlayBackgroundClass" />
|
<div class="fixed inset-0 transition-opacity" :class="overlayBackgroundClass" />
|
||||||
</TransitionChild>
|
</TransitionChild>
|
||||||
|
|
||||||
<div :class="wrapperClass">
|
<div :class="innerClass">
|
||||||
<div :class="containerClass">
|
<div :class="containerClass">
|
||||||
<TransitionChild
|
<TransitionChild
|
||||||
as="template"
|
as="template"
|
||||||
@@ -62,6 +62,10 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: () => $ui.modal.wrapper
|
default: () => $ui.modal.wrapper
|
||||||
},
|
},
|
||||||
|
innerClass: {
|
||||||
|
type: String,
|
||||||
|
default: () => $ui.modal.inner
|
||||||
|
},
|
||||||
containerClass: {
|
containerClass: {
|
||||||
type: String,
|
type: String,
|
||||||
default: () => $ui.modal.container
|
default: () => $ui.modal.container
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<TransitionRoot as="template" :appear="appear" :show="isOpen">
|
<TransitionRoot as="template" :appear="appear" :show="isOpen">
|
||||||
<Dialog
|
<Dialog :class="[wrapperClass, { 'justify-end': side === 'right' }]" @close="isOpen = false">
|
||||||
class="fixed inset-0 flex z-40"
|
|
||||||
:class="{
|
|
||||||
'justify-end': side === 'right'
|
|
||||||
}"
|
|
||||||
@close="isOpen = false"
|
|
||||||
>
|
|
||||||
<TransitionChild
|
<TransitionChild
|
||||||
v-if="overlay"
|
v-if="overlay"
|
||||||
as="template"
|
as="template"
|
||||||
@@ -53,6 +47,10 @@ const props = defineProps({
|
|||||||
default: 'left',
|
default: 'left',
|
||||||
validator: (value: string) => ['left', 'right'].includes(value)
|
validator: (value: string) => ['left', 'right'].includes(value)
|
||||||
},
|
},
|
||||||
|
wrapperClass: {
|
||||||
|
type: String,
|
||||||
|
default: () => $ui.slideover.wrapper
|
||||||
|
},
|
||||||
baseClass: {
|
baseClass: {
|
||||||
type: String,
|
type: String,
|
||||||
default: () => $ui.slideover.base
|
default: () => $ui.slideover.base
|
||||||
|
|||||||
@@ -250,7 +250,8 @@ export default (variantColors: string[]) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const modal = {
|
const modal = {
|
||||||
wrapper: 'fixed inset-0 overflow-y-auto',
|
wrapper: 'relative z-50',
|
||||||
|
inner: 'fixed inset-0 overflow-y-auto',
|
||||||
container: 'flex min-h-full items-end sm:items-center justify-center p-4 sm:p-0 text-center',
|
container: 'flex min-h-full items-end sm:items-center justify-center p-4 sm:p-0 text-center',
|
||||||
base: 'relative inline-block align-bottom text-left overflow-hidden transform transition-all sm:my-8 sm:align-middle w-full',
|
base: 'relative inline-block align-bottom text-left overflow-hidden transform transition-all sm:my-8 sm:align-middle w-full',
|
||||||
background: 'u-bg-white',
|
background: 'u-bg-white',
|
||||||
@@ -422,6 +423,7 @@ export default (variantColors: string[]) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const slideover = {
|
const slideover = {
|
||||||
|
wrapper: 'fixed inset-0 flex z-40',
|
||||||
overlay: {
|
overlay: {
|
||||||
background: 'bg-gray-500/75 dark:bg-gray-600/75',
|
background: 'bg-gray-500/75 dark:bg-gray-600/75',
|
||||||
transition: {
|
transition: {
|
||||||
|
|||||||
Reference in New Issue
Block a user