|
1 | 1 | <script setup lang="ts">
|
2 |
| -import { DrawerContent, DrawerOverlay, DrawerPortal, DrawerRoot, DrawerTrigger } from 'vaul-vue' |
| 2 | +import { type DrawerDirection, DrawerOverlay, DrawerPortal, DrawerRoot, DrawerTrigger } from 'vaul-vue' |
| 3 | +import { ref } from 'vue' |
| 4 | +import DrawerContentWrapper from './DrawerContent.vue' |
| 5 | +
|
| 6 | +const direction = ref<DrawerDirection>('bottom') |
3 | 7 | </script>
|
4 | 8 |
|
5 | 9 | <template>
|
6 |
| - <DrawerRoot should-scale-background direction="left"> |
| 10 | + <DrawerRoot should-scale-background :direction="direction"> |
7 | 11 | <DrawerTrigger
|
8 | 12 | class="rounded-full bg-white px-4 py-2.5 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50"
|
9 | 13 | >
|
10 | 14 | Open Drawer
|
11 | 15 | </DrawerTrigger>
|
12 | 16 | <DrawerPortal>
|
13 | 17 | <DrawerOverlay class="fixed bg-black/40 inset-0" />
|
14 |
| - <DrawerContent |
15 |
| - class="bg-gray-100 flex flex-col rounded-t-[10px] h-full mt-24 max-h-[96%] fixed bottom-0 left-0 right-0" |
16 |
| - > |
17 |
| - <div class="p-4 bg-white rounded-t-[10px] flex-1"> |
18 |
| - <div class="mx-auto w-12 h-1.5 flex-shrink-0 rounded-full bg-gray-300 mb-8" /> |
19 |
| - <div class="max-w-md mx-auto"> |
20 |
| - <h2 id="radix-:R3emdaH1:" class="font-medium mb-4"> |
21 |
| - Drawer for Vue. |
22 |
| - </h2> |
23 |
| - <p class="text-gray-600 mb-2"> |
24 |
| - This component can be used as a Dialog replacement on mobile and tablet devices. |
25 |
| - </p> |
26 |
| - <p class="text-gray-600 mb-2"> |
27 |
| - It comes unstyled, has gesture-driven animations, and is made by |
28 |
| - <a href="https://emilkowal.ski/" class="underline" target="_blank">Emil Kowalski</a>. |
29 |
| - </p> |
30 |
| - <p class="text-gray-600 mb-8"> |
31 |
| - It uses |
32 |
| - <a |
33 |
| - href="https://www.radix-ui.com/docs/primitives/components/dialog" |
34 |
| - class="underline" |
35 |
| - target="_blank" |
36 |
| - >Radix's Dialog primitive</a> |
37 |
| - under the hood and is inspired by |
38 |
| - <a |
39 |
| - href="https://twitter.com/devongovett/status/1674470185783402496" |
40 |
| - class="underline" |
41 |
| - target="_blank" |
42 |
| - >this tweet.</a> |
43 |
| - </p> |
44 |
| - </div> |
| 18 | + <DrawerContentWrapper :direction="direction"> |
| 19 | + <div class="max-w-md mx-auto"> |
| 20 | + <h2 id="radix-:R3emdaH1:" class="font-medium mb-4"> |
| 21 | + Drawer for Vue. |
| 22 | + </h2> |
| 23 | + <p class="text-gray-600 mb-2"> |
| 24 | + This component can be used as a Dialog replacement on mobile and tablet devices. |
| 25 | + </p> |
| 26 | + <p class="text-gray-600 mb-2"> |
| 27 | + It comes unstyled, has gesture-driven animations, and is made by |
| 28 | + <a href="https://emilkowal.ski/" class="underline" target="_blank">Emil Kowalski</a>. |
| 29 | + </p> |
| 30 | + <p class="text-gray-600 mb-8"> |
| 31 | + It uses |
| 32 | + <a |
| 33 | + href="https://www.radix-ui.com/docs/primitives/components/dialog" |
| 34 | + class="underline" |
| 35 | + target="_blank" |
| 36 | + >Radix's Dialog primitive</a> |
| 37 | + under the hood and is inspired by |
| 38 | + <a |
| 39 | + href="https://twitter.com/devongovett/status/1674470185783402496" |
| 40 | + class="underline" |
| 41 | + target="_blank" |
| 42 | + >this tweet.</a> |
| 43 | + </p> |
45 | 44 | </div>
|
46 |
| - </DrawerContent> |
| 45 | + </DrawerContentWrapper> |
47 | 46 | </DrawerPortal>
|
48 | 47 | </DrawerRoot>
|
49 | 48 | </template>
|
0 commit comments