import { motion, useReducedMotion, Variant } from 'framer-motion'; import { isNull } from 'lodash'; import { rgba } from 'polished'; import { useTheme } from 'styled-components'; import { Box, BoxProps } from '../../Box'; export type MenuSize = 'small' | 'large'; export interface MenuProps extends Pick { /** * The `animation` prop allows you to define the animation for each of the 4 animation states. */ animation?: { animate: Variant; exit: Variant; initial: Variant; } | null; /** * The `size` prop determines the padding and default width of the menu. */ size?: MenuSize; } export const Menu = ({ animation, children, tx, size = 'small', ...restOfProps }: MenuProps) => { const shouldReduceMotion = useReducedMotion(); const theme = useTheme(); const isSmallSize = size === 'small'; const defaultMenuAnimation: MenuProps['animation'] = { animate: { opacity: 1, y: 0, }, exit: { opacity: 0, y: shouldReduceMotion ? 0 : -12, }, initial: { opacity: 0, y: shouldReduceMotion ? 0 : -12, }, }; return ( {children} ); };