Skip to content

Commit

Permalink
Remove framer-motion from custom tooltip (#24449)
Browse files Browse the repository at this point in the history
* remove framer-motion from custom tooltip

* remove framer-motion type declaration file

(cherry picked from commit 98c6fa3)
  • Loading branch information
bbovenzi authored and ephraimbuddy committed Jun 29, 2022
1 parent b7026e5 commit baebdcc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 63 deletions.
68 changes: 33 additions & 35 deletions airflow/www/static/js/grid/components/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
Portal,
PortalProps,
} from '@chakra-ui/react';
import { AnimatePresence, motion } from 'framer-motion';

export interface TooltipProps
extends HTMLChakraProps<'div'>,
Expand Down Expand Up @@ -70,8 +69,6 @@ export interface TooltipProps
portalProps?: Pick<PortalProps, 'appendToParentPortal' | 'containerRef'>
}

const StyledTooltip = chakra(motion.div);

const styles = {
'--popper-arrow-bg': ['var(--tooltip-bg)'],
'--tooltip-bg': 'colors.gray.700',
Expand Down Expand Up @@ -137,41 +134,42 @@ const Tooltip = forwardRef<TooltipProps, 'div'>((props, ref) => {
return (
<>
{trigger}
<AnimatePresence>
{tooltip.isOpen && (
<Portal {...portalProps}>
{/* TODO: put back in AnimatePresence when we can upgrade framer-motion without ts errors */}
{/* <AnimatePresence> */}
{tooltip.isOpen && (
<Portal {...portalProps}>
<chakra.div
{...tooltip.getTooltipPositionerProps()}
__css={{
zIndex: styles.zIndex,
pointerEvents: 'none',
}}
>
<chakra.div
{...(tooltipProps as any)}
initial="exit"
animate="enter"
exit="exit"
__css={styles}
>
{label}
{hasArrow && (
<chakra.div
{...tooltip.getTooltipPositionerProps()}
__css={{
zIndex: styles.zIndex,
pointerEvents: 'none',
}}
data-popper-arrow
className="chakra-tooltip__arrow-wrapper"
>
<StyledTooltip
{...(tooltipProps as any)}
initial="exit"
animate="enter"
exit="exit"
__css={styles}
>
{label}
{hasArrow && (
<chakra.div
data-popper-arrow
className="chakra-tooltip__arrow-wrapper"
>
<chakra.div
data-popper-arrow-inner
className="chakra-tooltip__arrow"
__css={{ bg: styles.bg }}
/>
</chakra.div>
)}
</StyledTooltip>
<chakra.div
data-popper-arrow-inner
className="chakra-tooltip__arrow"
__css={{ bg: styles.bg }}
/>
</chakra.div>
</Portal>
)}
</AnimatePresence>
)}
</chakra.div>
</chakra.div>
</Portal>
)}
{/* </AnimatePresence> */}
</>
);
});
Expand Down
28 changes: 0 additions & 28 deletions airflow/www/static/js/grid/types/framer-motion.d.ts

This file was deleted.

0 comments on commit baebdcc

Please sign in to comment.