forked from unovue/radix-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: useBodyScrollLock (unovue#516)
* refactor: useBodyScrollLock * fix: body scroll unlocking prematurely * chore: test on nuxt playground
- Loading branch information
Showing
9 changed files
with
1,985 additions
and
1,769 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
packages/radix-vue/src/Dialog/story/DialogProgrammatic.story.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import { DialogContent, DialogOverlay, DialogRoot } from '../' | ||
const dialogAOpen = ref(false) | ||
const dialogBOpen = ref(false) | ||
function openA() { | ||
dialogBOpen.value = false | ||
dialogAOpen.value = true | ||
} | ||
function openB() { | ||
dialogAOpen.value = false | ||
dialogBOpen.value = true | ||
} | ||
function closeA(opened: boolean) { | ||
if (opened) | ||
dialogAOpen.value = false | ||
} | ||
function closeB(opened: boolean) { | ||
if (opened) | ||
dialogBOpen.value = false | ||
} | ||
</script> | ||
|
||
<template> | ||
<Story title="Dialog/Programmatic" :layout="{ type: 'single', iframe: true }"> | ||
<Variant title="default"> | ||
<div class="h-[300vh]"> | ||
<button | ||
class="text-black9 bg-blackA9 hover:bg-blackA10 rounded-[4px] text-white p-2" | ||
@click="openA" | ||
> | ||
Open A | ||
</button> | ||
<div v-if="dialogAOpen"> | ||
<DialogRoot v-model:open="dialogAOpen" @update:open="closeA"> | ||
<DialogOverlay class="bg-blackA9 fixed inset-0" /> | ||
<DialogContent | ||
class="fixed top-[50%] left-[50%] max-h-[85vh] w-[90vw] max-w-[450px] translate-x-[-50%] translate-y-[-50%] rounded-[6px] bg-white p-[25px]" | ||
> | ||
<h1>Dialog A</h1> | ||
<button | ||
class="text-black9 bg-blackA9 hover:bg-blackA10 rounded-[4px] text-white p-2" | ||
@click="openB" | ||
> | ||
Open B | ||
</button> | ||
</DialogContent> | ||
</DialogRoot> | ||
</div> | ||
<div v-if="dialogBOpen"> | ||
<DialogRoot v-model:open="dialogBOpen" @update:open="closeB"> | ||
<DialogOverlay class="bg-blackA9 fixed inset-0" /> | ||
<DialogContent | ||
class="fixed top-[50%] left-[50%] max-h-[85vh] w-[90vw] max-w-[450px] translate-x-[-50%] translate-y-[-50%] rounded-[6px] bg-white p-[25px]" | ||
> | ||
<h1>Dialog B</h1> | ||
<button | ||
class="text-black9 bg-blackA9 hover:bg-blackA10 rounded-[4px] text-white p-2" | ||
@click="openA" | ||
> | ||
Open A | ||
</button> | ||
</DialogContent> | ||
</DialogRoot> | ||
</div> | ||
</div> | ||
</Variant> | ||
</Story> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,31 @@ | ||
// https://nuxt.com/docs/api/configuration/nuxt-config | ||
export default defineNuxtConfig({ | ||
devtools: { enabled: true }, | ||
modules: ['radix-vue/nuxt', '@nuxtjs/tailwindcss'], | ||
components: [ | ||
{ | ||
path: '../../docs/components/demo', | ||
modules: ['@nuxtjs/tailwindcss'], | ||
// components: [ | ||
// { | ||
// path: '../../docs/components/demo', | ||
// }, | ||
// ], | ||
hooks: { | ||
'components:dirs': (dirs) => { | ||
dirs.unshift({ | ||
path: '../../docs/components/demo', | ||
ignore: ['**/css/**'], | ||
// this is required else Nuxt will autoImport `.ts` file | ||
extensions: ['.vue'], | ||
// prefix for your components, eg: UiButton | ||
prefix: '', | ||
// prevent adding another prefix component by it's path. | ||
pathPrefix: true, | ||
extendComponent(component) { | ||
return { | ||
...component, | ||
kebabName: component.kebabName.replace('-tailwind', ''), | ||
pascalName: component.pascalName.replace('Tailwind', ''), | ||
} | ||
}, | ||
}) | ||
}, | ||
], | ||
radix: { | ||
components: true, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.