Skip to content

Commit 4757c31

Browse files
committed
feat: add right-side slide-in direction to drawer
1 parent 4aac2f1 commit 4757c31

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/algora_web/components/ui/drawer.ex

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ defmodule AlgoraWeb.Components.UI.Drawer do
2121

2222
# Main drawer wrapper
2323
attr :show, :boolean, default: false, doc: "Controls drawer visibility"
24+
attr :direction, :string, default: "bottom", values: ["bottom", "right"], doc: "Drawer slide direction"
2425
attr :class, :string, default: nil
2526
attr :on_cancel, JS, default: %JS{}
2627
attr :rest, :global
@@ -41,8 +42,15 @@ defmodule AlgoraWeb.Components.UI.Drawer do
4142
<div
4243
class={
4344
classes([
44-
"fixed inset-x-0 bottom-0 z-50 transform rounded-t-xl border bg-background transition-transform duration-300 ease-in-out",
45-
"#{if @show, do: "translate-y-0", else: "translate-y-full"}",
45+
"fixed z-50 transform border bg-background transition-transform duration-300 ease-in-out",
46+
case @direction do
47+
"bottom" -> "inset-x-0 bottom-0 rounded-t-xl"
48+
"right" -> "inset-y-0 right-0 h-full max-w-lg"
49+
end,
50+
case @direction do
51+
"bottom" -> if(@show, do: "translate-y-0", else: "translate-y-full")
52+
"right" -> if(@show, do: "translate-x-0", else: "translate-x-full")
53+
end,
4654
@class
4755
])
4856
}

0 commit comments

Comments
 (0)