Skip to content

Commit

Permalink
feat: nested drawers (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cayllen authored Feb 24, 2024
1 parent b84d72f commit 5745b1c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions apps/www/src/lib/registry/default/ui/drawer/drawer-nested.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script lang="ts">
import { Drawer as DrawerPrimitive } from "vaul-svelte";
type $$Props = DrawerPrimitive.Props;
export let shouldScaleBackground: $$Props["shouldScaleBackground"] = true;
export let open: $$Props["open"] = false;
export let activeSnapPoint: $$Props["activeSnapPoint"] = undefined;
</script>

<DrawerPrimitive.NestedRoot {shouldScaleBackground} bind:open bind:activeSnapPoint {...$$restProps}>
<slot />
</DrawerPrimitive.NestedRoot>
4 changes: 4 additions & 0 deletions apps/www/src/lib/registry/default/ui/drawer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import Overlay from "./drawer-overlay.svelte";
import Footer from "./drawer-footer.svelte";
import Header from "./drawer-header.svelte";
import Title from "./drawer-title.svelte";
import NestedRoot from "./drawer-nested.svelte";

const Trigger = DrawerPrimitive.Trigger;
const Portal = DrawerPrimitive.Portal;
const Close = DrawerPrimitive.Close;

export {
Root,
NestedRoot,
Content,
Description,
Overlay,
Expand All @@ -23,8 +25,10 @@ export {
Trigger,
Portal,
Close,

//
Root as Drawer,
NestedRoot as DrawerNestedRoot,
Content as DrawerContent,
Description as DrawerDescription,
Overlay as DrawerOverlay,
Expand Down
12 changes: 12 additions & 0 deletions apps/www/src/lib/registry/new-york/ui/drawer/drawer-nested.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script lang="ts">
import { Drawer as DrawerPrimitive } from "vaul-svelte";
type $$Props = DrawerPrimitive.Props;
export let shouldScaleBackground: $$Props["shouldScaleBackground"] = true;
export let open: $$Props["open"] = false;
export let activeSnapPoint: $$Props["activeSnapPoint"] = undefined;
</script>

<DrawerPrimitive.NestedRoot {shouldScaleBackground} bind:open bind:activeSnapPoint {...$$restProps}>
<slot />
</DrawerPrimitive.NestedRoot>
3 changes: 3 additions & 0 deletions apps/www/src/lib/registry/new-york/ui/drawer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import Overlay from "./drawer-overlay.svelte";
import Footer from "./drawer-footer.svelte";
import Header from "./drawer-header.svelte";
import Title from "./drawer-title.svelte";
import NestedRoot from "./drawer-nested.svelte";

const Trigger = DrawerPrimitive.Trigger;
const Portal = DrawerPrimitive.Portal;
const Close = DrawerPrimitive.Close;

export {
Root,
NestedRoot,
Content,
Description,
Overlay,
Expand All @@ -25,6 +27,7 @@ export {
Close,
//
Root as Drawer,
NestedRoot as DrawerNestedRoot,
Content as DrawerContent,
Description as DrawerDescription,
Overlay as DrawerOverlay,
Expand Down

0 comments on commit 5745b1c

Please sign in to comment.