diff --git a/packages/components/src/Popover/index.tsx b/packages/components/src/Popover/index.tsx index 916302786c9..a64256cd305 100644 --- a/packages/components/src/Popover/index.tsx +++ b/packages/components/src/Popover/index.tsx @@ -26,6 +26,7 @@ export function Popover({ renderContent, floatingPanelProps, sheetProps, + onOpenChange, ...props }: PopoverProps) { const { bottom } = useSafeAreaInsets(); @@ -67,7 +68,13 @@ export function Popover({ } return ( - + {renderTrigger} {/* floating panel */} @@ -131,13 +138,12 @@ export function Popover({ {title} - - - + onOpenChange(false)} + /> {/* divider */} diff --git a/packages/kit/src/views/Components/stories/Popover.tsx b/packages/kit/src/views/Components/stories/Popover.tsx index d3c06607df3..462d63dcfac 100644 --- a/packages/kit/src/views/Components/stories/Popover.tsx +++ b/packages/kit/src/views/Components/stories/Popover.tsx @@ -1,35 +1,45 @@ +import { useState } from 'react'; + import { Button, Popover, Stack, Text } from '@onekeyhq/components'; import { Layout } from './utils/Layout'; -const PopoverGallery = () => ( - Open} - renderContent={ - - - Non exercitation ea laborum cupidatat sunt amet aute - exercitation occaecat minim incididunt non est est voluptate. - - - - - - } - /> - ), - }, - ]} - /> -); +const PopoverGallery = () => { + const [isOpen, setIsOpen] = useState(false); + return ( + setIsOpen(true)}>Open + } + renderContent={ + + + Non exercitation ea laborum cupidatat sunt amet aute + exercitation occaecat minim incididunt non est est + voluptate. + + + + } + /> + ), + }, + ]} + /> + ); +}; export default PopoverGallery;