Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Jul 11, 2022
1 parent a1ceb1f commit 97de3e4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
23 changes: 20 additions & 3 deletions src/runtime/components/overlays/Slideover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
leave-from="translate-x-0"
:leave-to="side === 'left' ? '-translate-x-full' : 'translate-x-full'"
>
<DialogPanel class="relative flex-1 flex flex-col w-full focus:outline-none" :class="panelClass">
<DialogPanel :class="slideoverClass">
<div v-if="$slots.header" :class="headerWrapperClass">
<div :class="headerClass">
<slot name="header" />
Expand All @@ -45,6 +45,7 @@
import { computed } from 'vue'
import type { WritableComputedRef, PropType } from 'vue'
import { Dialog, DialogPanel, TransitionRoot, TransitionChild } from '@headlessui/vue'
import { classNames } from '../../utils/'
import $ui from '#build/ui'
const props = defineProps({
Expand All @@ -57,13 +58,21 @@ const props = defineProps({
default: 'left',
validator: (value: string) => ['left', 'right'].includes(value)
},
baseClass: {
type: String,
default: () => $ui.slideover.base
},
backgroundClass: {
type: String,
default: () => $ui.slideover.background
},
overlayClass: {
type: String,
default: () => $ui.slideover.overlay
},
panelClass: {
widthClass: {
type: String,
default: () => $ui.slideover.panel
default: () => $ui.slideover.width
},
headerWrapperClass: {
type: String,
Expand All @@ -84,6 +93,14 @@ const isOpen: WritableComputedRef<boolean> = computed({
emit('update:modelValue', value)
}
})
const slideoverClass = computed(() => {
return classNames(
props.baseClass,
props.widthClass,
props.backgroundClass
)
})
</script>

<script lang="ts">
Expand Down
4 changes: 3 additions & 1 deletion src/runtime/presets/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,9 @@ export default (variantColors: string[]) => {

const slideover = {
overlay: 'bg-gray-500/75 dark:bg-gray-600/75',
panel: 'u-bg-white max-w-md',
base: 'relative flex-1 flex flex-col w-full focus:outline-none',
background: 'u-bg-white',
width: 'max-w-md',
header: {
wrapper: 'border-b u-border-gray-200',
base: 'flex items-center justify-between px-4 sm:px-6 h-16'
Expand Down

0 comments on commit 97de3e4

Please sign in to comment.