From ce3a6dab1247f2700eb3359492c1643df4775cd4 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Tue, 13 Aug 2024 19:14:34 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F(frontend)=20make=20Dialog's?= =?UTF-8?q?=20title=20optional?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce an option to render or omit the title in the Dialog component. This is necessary for the advanced settings Dialog, which displays its title in the Tab menu. This could affect existing component API created by @manuhabitela. The component will become less opinionated, offering more flexibility in its usage (I am not 100% convinced it's actually a great idea). Quick fix! Let's enhance it --- src/frontend/src/primitives/Dialog.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/frontend/src/primitives/Dialog.tsx b/src/frontend/src/primitives/Dialog.tsx index 0c5c044f..02e2bf47 100644 --- a/src/frontend/src/primitives/Dialog.tsx +++ b/src/frontend/src/primitives/Dialog.tsx @@ -48,7 +48,7 @@ const StyledRACDialog = styled(RACDialog, { }) export type DialogProps = RACDialogProps & { - title: string + title?: string onClose?: () => void /** * use the Dialog as a controlled component @@ -96,13 +96,15 @@ export const Dialog = ({ pointerEvents="auto" > - - {title} - + {!!title && ( + + {title} + + )} {typeof children === 'function' ? children({ close }) : children}