mirror of
https://github.com/tloncorp/landscape.git
synced 2024-12-01 02:45:49 +03:00
Make portal optional on dialog, don't use within another dialog
This commit is contained in:
parent
d669ead35c
commit
ca56841842
@ -102,7 +102,7 @@ export const AppInfo: FC<AppInfoProps> = ({
|
||||
</PillButton>
|
||||
)}
|
||||
{installStatus !== 'installed' && (
|
||||
<Dialog>
|
||||
<Dialog portal={false}>
|
||||
<DialogTrigger asChild>
|
||||
<PillButton variant="alt-primary" disabled={installing}>
|
||||
{installing ? (
|
||||
|
@ -3,16 +3,31 @@ import * as DialogPrimitive from '@radix-ui/react-dialog';
|
||||
import type * as Polymorphic from '@radix-ui/react-polymorphic';
|
||||
import classNames from 'classnames';
|
||||
|
||||
export const Dialog: FC<DialogPrimitive.DialogProps> = ({
|
||||
export type DialogProps = Polymorphic.Merge<
|
||||
Polymorphic.OwnProps<typeof DialogPrimitive.Root>,
|
||||
{
|
||||
portal?: boolean;
|
||||
}
|
||||
>;
|
||||
|
||||
export const Dialog: FC<DialogProps> = ({
|
||||
children,
|
||||
portal = true,
|
||||
...props
|
||||
}) => {
|
||||
return (
|
||||
<DialogPrimitive.Root {...props}>
|
||||
<DialogPrimitive.Portal>
|
||||
<DialogPrimitive.Overlay className="fixed top-0 bottom-0 left-0 right-0 z-30 transform-gpu bg-black opacity-30" />
|
||||
{children}
|
||||
</DialogPrimitive.Portal>
|
||||
{portal ? (
|
||||
<DialogPrimitive.Portal>
|
||||
<DialogPrimitive.Overlay className="fixed top-0 bottom-0 left-0 right-0 z-30 transform-gpu bg-black opacity-30" />
|
||||
{children}
|
||||
</DialogPrimitive.Portal>
|
||||
) : (
|
||||
<>
|
||||
<DialogPrimitive.Overlay className="fixed top-0 bottom-0 left-0 right-0 z-30 transform-gpu bg-black opacity-30" />
|
||||
{children}
|
||||
</>
|
||||
)}
|
||||
</DialogPrimitive.Root>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user