♻️(frontend) make Dialog's title optional
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
This commit is contained in:
committed by
aleb_the_flash
parent
1b57dd0ecf
commit
ce3a6dab12
@@ -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"
|
||||
>
|
||||
<Box size="sm" type="dialog">
|
||||
<Heading
|
||||
slot="title"
|
||||
level={1}
|
||||
className={text({ variant: 'h1' })}
|
||||
>
|
||||
{title}
|
||||
</Heading>
|
||||
{!!title && (
|
||||
<Heading
|
||||
slot="title"
|
||||
level={1}
|
||||
className={text({ variant: 'h1' })}
|
||||
>
|
||||
{title}
|
||||
</Heading>
|
||||
)}
|
||||
{typeof children === 'function'
|
||||
? children({ close })
|
||||
: children}
|
||||
|
||||
Reference in New Issue
Block a user