Skip to content

Commit

Permalink
Popover: update positionToPlacement types
Browse files Browse the repository at this point in the history
  • Loading branch information
brookewp committed Aug 31, 2023
1 parent e2941e9 commit 40966cd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/components/src/popover/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
*/
// eslint-disable-next-line no-restricted-imports
import type { MotionProps } from 'framer-motion';
import type { ReferenceType, VirtualElement } from '@floating-ui/react-dom';
import type {
Placement,
ReferenceType,
VirtualElement,
} from '@floating-ui/react-dom';

/**
* Internal dependencies
Expand All @@ -16,7 +20,7 @@ import type {

const POSITION_TO_PLACEMENT: Record<
NonNullable< PopoverProps[ 'position' ] >,
NonNullable< PopoverProps[ 'placement' ] >
Placement
> = {
bottom: 'bottom',
top: 'top',
Expand Down Expand Up @@ -79,8 +83,7 @@ const POSITION_TO_PLACEMENT: Record<
*/
export const positionToPlacement = (
position: NonNullable< PopoverProps[ 'position' ] >
): NonNullable< PopoverProps[ 'placement' ] > =>
POSITION_TO_PLACEMENT[ position ] ?? 'bottom';
) => POSITION_TO_PLACEMENT[ position ] ?? 'bottom';

/**
* @typedef AnimationOrigin
Expand Down

0 comments on commit 40966cd

Please sign in to comment.