-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(popover): popover portal subcomponent
- Loading branch information
Showing
5 changed files
with
91 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
import type { FC } from 'react' | ||
|
||
import { Anchor, type AnchorProps } from './PopoverAnchor' | ||
import { Arrow, type ArrowProps } from './PopoverArrow' | ||
import { Content, type ContentProps } from './PopoverContent' | ||
import { Anchor } from './PopoverAnchor' | ||
import { Arrow } from './PopoverArrow' | ||
import { Content } from './PopoverContent' | ||
import { Portal } from './PopoverPortal' | ||
import { Root, type RootProps } from './PopoverRoot' | ||
import { Trigger, type TriggerProps } from './PopoverTrigger' | ||
import { Trigger } from './PopoverTrigger' | ||
|
||
Trigger.displayName = 'Popover.Trigger' | ||
Anchor.displayName = 'Popover.Anchor' | ||
Arrow.displayName = 'Popover.Arrow' | ||
Content.displayName = 'Popover.Content' | ||
Portal.displayName = 'Popover.Portal' | ||
Trigger.displayName = 'Popover.Trigger' | ||
|
||
export const Popover: FC<RootProps> & { | ||
Trigger: FC<TriggerProps> | ||
Anchor: FC<AnchorProps> | ||
Arrow: FC<ArrowProps> | ||
Content: FC<ContentProps> | ||
Anchor: typeof Anchor | ||
Arrow: typeof Arrow | ||
Content: typeof Content | ||
Portal: typeof Portal | ||
Trigger: typeof Trigger | ||
} = Object.assign(Root, { | ||
Trigger, | ||
Anchor, | ||
Arrow, | ||
Content, | ||
Portal, | ||
Trigger, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * as RadixPopover from '@radix-ui/react-popover' | ||
import { ReactElement } from 'react' | ||
|
||
export type PortalProps = RadixPopover.PopoverPortalProps | ||
|
||
export const Portal = ({ children, ...rest }: PortalProps): ReactElement => ( | ||
<RadixPopover.Portal {...rest}>{children}</RadixPopover.Portal> | ||
) | ||
|
||
Portal.displayName = 'Popover.Portal' |