From fd32597a70a4e26c6189d8438303b8635c38381e Mon Sep 17 00:00:00 2001 From: LuizGarbini Date: Tue, 27 Jan 2026 17:09:02 -0300 Subject: [PATCH] refactor(list-form): implement drawer mode for list form component - Added support for 'drawer' mode in ListForm, allowing it to be displayed in a drawer instead of a dialog. - Updated ListFormProps to include a mode prop. - Adjusted ListsDropdown to utilize both dialog and drawer modes for the ListForm component. --- .../[lang]/lists/_components/list-form.tsx | 306 ++++++++++-------- .../src/components/lists/lists-dropdown.tsx | 2 + 2 files changed, 174 insertions(+), 134 deletions(-) diff --git a/apps/web/src/app/[lang]/lists/_components/list-form.tsx b/apps/web/src/app/[lang]/lists/_components/list-form.tsx index f4fdb0df..9ed49189 100644 --- a/apps/web/src/app/[lang]/lists/_components/list-form.tsx +++ b/apps/web/src/app/[lang]/lists/_components/list-form.tsx @@ -9,6 +9,13 @@ import { DialogTitle, DialogTrigger, } from '@plotwist/ui/components/ui/dialog' +import { + Drawer, + DrawerContent, + DrawerHeader, + DrawerTitle, + DrawerTrigger, +} from '@plotwist/ui/components/ui/drawer' import { Form, FormControl, @@ -34,9 +41,15 @@ import { getGetListsQueryKey, usePostList, usePutListId } from '@/api/list' import { useLanguage } from '@/context/language' import { type ListFormValues, listFormSchema } from './list-form-schema' -type ListFormProps = { trigger: React.ReactNode; list?: GetListById200List } +type ListFormMode = 'dialog' | 'drawer' + +type ListFormProps = { + trigger: React.ReactNode + list?: GetListById200List + mode?: ListFormMode +} -export const ListForm = ({ trigger, list }: ListFormProps) => { +export const ListForm = ({ trigger, list, mode = 'dialog' }: ListFormProps) => { const [open, setOpen] = useState(false) const { dictionary, language } = useLanguage() const { push, refresh } = useRouter() @@ -94,142 +107,167 @@ export const ListForm = ({ trigger, list }: ListFormProps) => { ) } + const Content = ( + <> +
+ + ( + + {dictionary.title} + + + + + + + + )} + /> + + ( + + {dictionary.list_form.description} + +