Skip to content

Commit

Permalink
restore passing hide function in callback
Browse files Browse the repository at this point in the history
  • Loading branch information
yyanwang committed Oct 23, 2023
1 parent 04d9d95 commit 13b3b81
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/design-system/src/components/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type PopoverProps = {
} & PopoverOptions;

export type PopoverStateReturn = {
setOpen: () => void;
hide: () => void;
};

export function Popover({
Expand Down Expand Up @@ -73,6 +73,7 @@ export function Popover({
? children({
...popover.getFloatingProps(),
setOpen: popover.setOpen,
hide: () => popover.setOpen(false),
})
: children}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const WithFunctionAsChildren = () => (
{(popover: PopoverStateReturn) => (
<StackVertical gap="S">
There is some content
<ButtonPrimary onClick={() => popover?.setOpen(false)}>Close Me please</ButtonPrimary>
<ButtonPrimary onClick={() => popover?.hide()}>Close Me please</ButtonPrimary>
</StackVertical>
)}
<EasyPopover />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const BasicSearch = ({
initialFilterValue={initialFilterValue}
onClick={(...args) => {
onClickOverlayRow(...args);
popover?.setOpen(false);
popover?.hide();
}}
t={t}
/>
Expand Down

0 comments on commit 13b3b81

Please sign in to comment.