-
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.
feat: Rewrite Slideover with Radix UI
- Loading branch information
Showing
3 changed files
with
92 additions
and
159 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,35 @@ | ||
<script setup lang="ts"> | ||
import { UiContainer, UiSlideover } from "#components"; | ||
import { ref } from "vue"; | ||
const showSlideover = ref(false); | ||
import { UiButton, UiContainer, UiSlideover } from '#components'; | ||
import { DialogClose, DialogTitle } from 'radix-vue'; | ||
</script> | ||
|
||
<template> | ||
<UiContainer class="py-8"> | ||
<h1 class="demo-page-title">Slideover</h1> | ||
<p class="demo-page-description"> | ||
Modal that slides from the side of the screen to call the attention of the | ||
user. | ||
Modal that slides from the side of the screen to call the attention of the user. | ||
</p> | ||
|
||
<UiButton | ||
class="mt-3" | ||
label="Open slideover" | ||
@click="showSlideover = true" | ||
/> | ||
<UiSlideover> | ||
<template #trigger> | ||
<UiButton label="Open slideover" class="mt-4" /> | ||
</template> | ||
|
||
<template #content> | ||
<div class="px-6 py-8"> | ||
<DialogTitle class="text-xl font-medium text-gray-900">This is a slideover</DialogTitle> | ||
|
||
<UiSlideover v-model="showSlideover" side="left"> | ||
<div class="flex flex-col px-4 py-6"> | ||
<h2 class="text-xl font-medium text-gray-900">This is a slideover</h2> | ||
<p class="mt-3 text-gray-600"> | ||
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Earum fugit | ||
impedit, natus, ea libero vitae soluta expedita ratione mollitia fuga | ||
similique, dicta aliquam? Distinctio nulla, vel quibusdam eligendi | ||
nostrum perferendis! | ||
</p> | ||
<p class="mt-3 text-gray-600"> | ||
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Earum fugit impedit, natus, ea libero | ||
vitae soluta expedita ratione mollitia fuga similique, dicta aliquam? Distinctio nulla, vel | ||
quibusdam eligendi nostrum perferendis! | ||
</p> | ||
|
||
<UiButton | ||
block | ||
class="mt-3" | ||
label="Close slideover" | ||
@click="showSlideover = false" | ||
/> | ||
</div> | ||
<DialogClose as-child> | ||
<UiButton label="Close dialog" class="mt-4" /> | ||
</DialogClose> | ||
</div> | ||
</template> | ||
</UiSlideover> | ||
</UiContainer> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,8 @@ | ||
export default /*ui*/ { | ||
wrapper: 'relative z-40', | ||
inner: 'fixed inset-0 z-10', | ||
container: 'flex min-h-full justify-end', | ||
padding: 'min-w-[3rem] px-1 py-4 flex flex-col', | ||
base: 'relative h-screen overflow-y-scroll', | ||
background: 'bg-white', | ||
ring: '', | ||
rounded: '', | ||
shadow: 'shadow-xl', | ||
width: 'flex-1 max-w-md', | ||
overlay: { | ||
base: 'fixed inset-0 transition-opacity', | ||
background: 'bg-gray-900/70 backdrop-blur-sm backdrop-filter', | ||
transition: { | ||
enter: 'ease-out duration-300', | ||
enterFrom: 'opacity-0', | ||
enterTo: 'opacity-100', | ||
leave: 'ease-in duration-200', | ||
leaveFrom: 'opacity-100', | ||
leaveTo: 'opacity-0', | ||
}, | ||
}, | ||
transition: { | ||
enter: 'transform transition ease-in-out duration-500 sm:duration-700', | ||
leave: 'transform transition ease-in-out duration-500 sm:duration-700', | ||
}, | ||
container: 'fixed z-50 bg-white shadow-xl', | ||
size: '', | ||
overlay: | ||
'fixed inset-0 z-40 bg-black/70 backdrop-blur-sm backdrop-filter duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0', | ||
transition: | ||
'transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500', | ||
}; |