From 62ed61059f784171658dd2abc8827efd2acd9d4b Mon Sep 17 00:00:00 2001 From: "Irsyad A. Panjaitan" Date: Fri, 25 Oct 2024 18:33:59 +0700 Subject: [PATCH] lfg --- components/docs/generated/previews.ts | 14 +- .../overlays/drawer/drawer-basic-demo.tsx | 11 +- .../drawer/drawer-controlled-demo.tsx | 21 +- .../overlays/drawer/drawer-direction-demo.tsx | 42 -- .../drawer/drawer-hide-notch-demo.tsx | 23 -- .../drawer/drawer-is-not-centered-demo.tsx | 24 -- .../overlays/drawer/drawer-nested-demo.tsx | 78 ++++ .../overlays/drawer/drawer-sticky-demo.tsx | 114 ++++++ .../drawer/drawer-without-notch-demo.tsx | 27 ++ components/ui/drawer.tsx | 382 +++++++++++------- .../docs/components/overlays/drawer.mdx | 41 +- 11 files changed, 506 insertions(+), 271 deletions(-) delete mode 100644 components/docs/overlays/drawer/drawer-direction-demo.tsx delete mode 100644 components/docs/overlays/drawer/drawer-hide-notch-demo.tsx delete mode 100644 components/docs/overlays/drawer/drawer-is-not-centered-demo.tsx create mode 100644 components/docs/overlays/drawer/drawer-nested-demo.tsx create mode 100644 components/docs/overlays/drawer/drawer-sticky-demo.tsx create mode 100644 components/docs/overlays/drawer/drawer-without-notch-demo.tsx diff --git a/components/docs/generated/previews.ts b/components/docs/generated/previews.ts index c052c3c6..dad4d6da 100644 --- a/components/docs/generated/previews.ts +++ b/components/docs/generated/previews.ts @@ -326,21 +326,21 @@ export const previews: Record = { "buttons/button/button-link-demo": { component: React.lazy(() => import("@/components/docs/buttons/button/button-link-demo")), }, - "overlays/drawer/drawer-direction-demo": { - component: React.lazy(() => import("@/components/docs/overlays/drawer/drawer-direction-demo")), - }, - "overlays/drawer/drawer-hide-notch-demo": { - component: React.lazy(() => import("@/components/docs/overlays/drawer/drawer-hide-notch-demo")), + "overlays/drawer/drawer-nested-demo": { + component: React.lazy(() => import("@/components/docs/overlays/drawer/drawer-nested-demo")), }, "overlays/drawer/drawer-basic-demo": { component: React.lazy(() => import("@/components/docs/overlays/drawer/drawer-basic-demo")), }, - "overlays/drawer/drawer-is-not-centered-demo": { - component: React.lazy(() => import("@/components/docs/overlays/drawer/drawer-is-not-centered-demo")), + "overlays/drawer/drawer-sticky-demo": { + component: React.lazy(() => import("@/components/docs/overlays/drawer/drawer-sticky-demo")), }, "overlays/drawer/drawer-controlled-demo": { component: React.lazy(() => import("@/components/docs/overlays/drawer/drawer-controlled-demo")), }, + "overlays/drawer/drawer-without-notch-demo": { + component: React.lazy(() => import("@/components/docs/overlays/drawer/drawer-without-notch-demo")), + }, "overlays/tooltip/tooltip-delay-demo": { component: React.lazy(() => import("@/components/docs/overlays/tooltip/tooltip-delay-demo")), }, diff --git a/components/docs/overlays/drawer/drawer-basic-demo.tsx b/components/docs/overlays/drawer/drawer-basic-demo.tsx index f1037207..7129f8fc 100644 --- a/components/docs/overlays/drawer/drawer-basic-demo.tsx +++ b/components/docs/overlays/drawer/drawer-basic-demo.tsx @@ -1,6 +1,8 @@ "use client" -import { Button, buttonStyles, Drawer, TextField } from "ui" +import React from "react" + +import { buttonStyles, Drawer, TextField } from "ui" export default function DrawerBasicDemo() { return ( @@ -14,12 +16,11 @@ export default function DrawerBasicDemo() { - - + + - Cancel - + Login diff --git a/components/docs/overlays/drawer/drawer-controlled-demo.tsx b/components/docs/overlays/drawer/drawer-controlled-demo.tsx index e3618c5d..e0e6785c 100644 --- a/components/docs/overlays/drawer/drawer-controlled-demo.tsx +++ b/components/docs/overlays/drawer/drawer-controlled-demo.tsx @@ -2,24 +2,35 @@ import React from "react" -import { Button, Drawer } from "ui" +import { Button, Drawer, TextField } from "ui" export default function DrawerControlledDemo() { const [isOpen, setIsOpen] = React.useState(false) return ( <> - + - Drawer + Login - A slide-in overlay for extra content or options. + Please enter your credentials to access your account. + + + + Close - + diff --git a/components/docs/overlays/drawer/drawer-direction-demo.tsx b/components/docs/overlays/drawer/drawer-direction-demo.tsx deleted file mode 100644 index 35ead120..00000000 --- a/components/docs/overlays/drawer/drawer-direction-demo.tsx +++ /dev/null @@ -1,42 +0,0 @@ -"use client" - -import React from "react" - -import { Button, Drawer } from "ui" - -type Sides = "bottom" | "top" | "left" | "right" - -export default function DrawerDirectionDemo() { - const [isOpen, setIsOpen] = React.useState(false) - const [openSide, setOpenSide] = React.useState("bottom") - const sides: Sides[] = ["bottom", "top", "left", "right"] - const handlePress = (side: Sides) => { - setOpenSide(side) - setIsOpen(true) - } - return ( -
-
- {sides.map((side) => ( - - ))} -
- - - - - {openSide} - The drawer will slide in from the {openSide}. - - - - Close - - - - -
- ) -} diff --git a/components/docs/overlays/drawer/drawer-hide-notch-demo.tsx b/components/docs/overlays/drawer/drawer-hide-notch-demo.tsx deleted file mode 100644 index 9369428d..00000000 --- a/components/docs/overlays/drawer/drawer-hide-notch-demo.tsx +++ /dev/null @@ -1,23 +0,0 @@ -"use client" - -import { Button, buttonStyles, Drawer } from "ui" - -export default function DrawerHideNotchDemo() { - return ( - - - Open Drawer - - - - Drawer - A slide-in overlay for extra content or options. - - - Close - - - - - ) -} diff --git a/components/docs/overlays/drawer/drawer-is-not-centered-demo.tsx b/components/docs/overlays/drawer/drawer-is-not-centered-demo.tsx deleted file mode 100644 index 4a3c50d5..00000000 --- a/components/docs/overlays/drawer/drawer-is-not-centered-demo.tsx +++ /dev/null @@ -1,24 +0,0 @@ -"use client" - -import { Button, buttonStyles, Drawer } from "ui" - -export default function DrawerIsNotCenteredDemo() { - return ( - - - Open Drawer - - - - Drawer - A slide-in overlay for extra content or options. - - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sus - - Close - - - - - ) -} diff --git a/components/docs/overlays/drawer/drawer-nested-demo.tsx b/components/docs/overlays/drawer/drawer-nested-demo.tsx new file mode 100644 index 00000000..54e7dea8 --- /dev/null +++ b/components/docs/overlays/drawer/drawer-nested-demo.tsx @@ -0,0 +1,78 @@ +"use client" + +import React from "react" + +import { toast } from "sonner" +import { Button, Drawer, Form, Textarea } from "ui" + +export default function DrawerNestedDemo() { + const [isRegistrationDrawerOpen, setIsRegistrationDrawerOpen] = React.useState(false) + const [isProfileSetupDrawerOpen, setIsProfileSetupDrawerOpen] = React.useState(false) + const [isTyping, setIsTyping] = React.useState(false) + + return ( + <> + + + setIsRegistrationDrawerOpen(false)} + > + + + Confirm Registration + Please confirm your registration details. + + + Cancel + + + + + + { + if (!isOpen && isTyping) toast("Profile setup incomplete", { position: "top-center" }) + setIsProfileSetupDrawerOpen(isOpen) + }} + > + + + Set Up Your Profile + + We need a bit more information before you can get started. + + +
{ + e.preventDefault() + toast.success("Profile setup complete", { position: "top-center" }) + setIsProfileSetupDrawerOpen(false) + setIsRegistrationDrawerOpen(false) + }} + > + +