Skip to content

Commit

Permalink
Popover: Use anchor instead of anchorRef in story (#67674)
Browse files Browse the repository at this point in the history
Co-authored-by: tyxla <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
3 people authored Dec 6, 2024
1 parent b062f3e commit b6cfa1e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/components/src/popover/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ const meta: Meta< typeof Popover > = {
export default meta;

const PopoverWithAnchor = ( args: PopoverProps ) => {
const anchorRef = useRef( null );
const [ popoverAnchor, setPopoverAnchor ] = useState< Element | null >(
null
);

return (
<div
Expand All @@ -71,11 +73,11 @@ const PopoverWithAnchor = ( args: PopoverProps ) => {
>
<p
style={ { padding: '8px', background: 'salmon' } }
ref={ anchorRef }
ref={ setPopoverAnchor }
>
Popover&apos;s anchor
</p>
<Popover { ...args } anchorRef={ anchorRef } />
<Popover { ...args } anchor={ popoverAnchor } />
</div>
);
};
Expand Down

0 comments on commit b6cfa1e

Please sign in to comment.