From 4674f90f8afa42cc9283271444c7fd9187270860 Mon Sep 17 00:00:00 2001 From: D0dii Date: Tue, 17 Sep 2024 18:52:26 +0200 Subject: [PATCH] feat: delete, copy plan, style plans page --- ...DeletePlanConfirmationResponsiveDialog.tsx | 97 +++++++++++++++++++ src/components/Plan.tsx | 8 +- src/pages/app/plans.tsx | 11 +-- 3 files changed, 103 insertions(+), 13 deletions(-) create mode 100644 src/components/DeletePlanConfirmationResponsiveDialog.tsx diff --git a/src/components/DeletePlanConfirmationResponsiveDialog.tsx b/src/components/DeletePlanConfirmationResponsiveDialog.tsx new file mode 100644 index 0000000..7689473 --- /dev/null +++ b/src/components/DeletePlanConfirmationResponsiveDialog.tsx @@ -0,0 +1,97 @@ +import * as React from "react"; + +import { Button } from "@/components/ui/button"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { + Drawer, + DrawerContent, + DrawerHeader, + DrawerTitle, + DrawerTrigger, +} from "@/components/ui/drawer"; +import { useMediaQuery } from "@/lib/useMediaQuery"; + +export const DeletePlanConfirmationResponsiveDialog = ({ + deletePlan, +}: { + deletePlan: () => void; +}) => { + const [open, setOpen] = React.useState(false); + const isDesktop = useMediaQuery("(min-width: 768px)"); + const closeDialog = () => { + setOpen(false); + }; + if (isDesktop) { + return ( + + + + + + + Czy na pewno chcesz usunąć plan? + + + + + ); + } + + return ( + + + + + + + Czy na pewno chcesz usunąć plan + + + + + ); +}; + +function DeletePlan({ + deletePlan, + closeDialog, +}: { + deletePlan: () => void; + closeDialog: () => void; +}) { + return ( +
+ + +
+ ); +} diff --git a/src/components/Plan.tsx b/src/components/Plan.tsx index ec46c6b..d2f7fcf 100644 --- a/src/components/Plan.tsx +++ b/src/components/Plan.tsx @@ -13,6 +13,7 @@ import { cn } from "@/lib/utils"; import { planFamily } from "@/pages/createplan/[id]"; import { plansIds } from "@/pages/plans"; +import { DeletePlanConfirmationResponsiveDialog } from "./DeletePlanConfirmationResponsiveDialog"; import { buttonVariants } from "./ui/button"; export const Plan = ({ id, name }: { id: string; name: string }) => { @@ -60,12 +61,7 @@ export const Plan = ({ id, name }: { id: string; name: string }) => { > Kopiuj - + diff --git a/src/pages/app/plans.tsx b/src/pages/app/plans.tsx index fb440c8..fb5fc08 100644 --- a/src/pages/app/plans.tsx +++ b/src/pages/app/plans.tsx @@ -7,7 +7,7 @@ import { planFamily } from "@/atoms/planFamily"; import { Plan } from "@/components/Plan"; import { Seo } from "@/components/SEO"; import { SolvroLogo } from "@/components/SolvroLogo"; -import { buttonVariants } from "@/components/ui/button"; +import { Button, buttonVariants } from "@/components/ui/button"; import { cn } from "@/lib/utils"; export const plansIds = atomWithStorage>("plansIds", []); @@ -61,12 +61,9 @@ const Plans = () => {
- +
+ +
{plans.map((plan) => ( ))}