Skip to content

Commit

Permalink
feat(Slideover): allow opening from the right side (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
smarroufin committed Jun 23, 2022
1 parent c3a200d commit aecfef2
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/runtime/components/overlays/Slideover.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<template>
<TransitionRoot as="template" :show="isOpen">
<Dialog class="fixed inset-0 flex z-40" @close="isOpen = false">
<Dialog
class="fixed inset-0 flex z-40"
:class="{
'justify-end': side === 'right'
}"
@close="isOpen = false"
>
<TransitionChild
as="template"
enter="transition-opacity ease-linear duration-300"
Expand All @@ -16,11 +22,11 @@
<TransitionChild
as="template"
enter="transition ease-in-out duration-300 transform"
enter-from="-translate-x-full"
:enter-from="side === 'left' ? '-translate-x-full' : 'translate-x-full'"
enter-to="translate-x-0"
leave="transition ease-in-out duration-300 transform"
leave-from="translate-x-0"
leave-to="-translate-x-full"
:leave-to="side === 'left' ? '-translate-x-full' : 'translate-x-full'"
>
<DialogPanel class="relative flex-1 flex flex-col w-full max-w-md u-bg-white focus:outline-none">
<div v-if="$slots.header" class="border-b u-border-gray-200">
Expand All @@ -45,6 +51,11 @@ const props = defineProps({
modelValue: {
type: Boolean as PropType<boolean>,
default: false
},
side: {
type: String,
default: 'left',
validator: (value: string) => ['left', 'right'].includes(value)
}
})
const emit = defineEmits(['update:modelValue'])
Expand Down

0 comments on commit aecfef2

Please sign in to comment.