fix: SW-1010 Optimized code
This commit is contained in:
@@ -17,10 +17,9 @@ import styles from "./popover.module.css"
|
||||
export default function Popover({
|
||||
triggerContent,
|
||||
children,
|
||||
isNestedPopover = false,
|
||||
...props
|
||||
}: PopoverProps) {
|
||||
const setOverflowVisible = useSetOverFlowVisibleOnRA(isNestedPopover)
|
||||
const setOverflowVisible = useSetOverFlowVisibleOnRA()
|
||||
|
||||
return (
|
||||
<DialogTrigger onOpenChange={setOverflowVisible}>
|
||||
|
||||
@@ -3,5 +3,4 @@ import type { PopoverProps as RAPopoverProps } from "react-aria-components"
|
||||
export interface PopoverProps extends Omit<RAPopoverProps, "children"> {
|
||||
triggerContent: React.ReactNode
|
||||
children: React.ReactNode
|
||||
isNestedPopover?: boolean
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default function useSetOverflowVisibleOnRA(isNestedInModal: boolean) {
|
||||
export default function useSetOverflowVisibleOnRA(isNestedInModal?: boolean) {
|
||||
function setOverflowVisible(isOpen: boolean) {
|
||||
if (isOpen) {
|
||||
document.body.style.overflow = "visible"
|
||||
|
||||
Reference in New Issue
Block a user