import { Box } from '@chakra-ui/react'; import { memo, useMemo } from 'react'; type Props = { isSelected: boolean; isHovered: boolean; }; const SelectionOverlay = ({ isSelected, isHovered }: Props) => { const shadow = useMemo(() => { if (isSelected && isHovered) { return 'nodeHoveredSelected.light'; } if (isSelected) { return 'nodeSelected.light'; } if (isHovered) { return 'nodeHovered.light'; } return undefined; }, [isHovered, isSelected]); const shadowDark = useMemo(() => { if (isSelected && isHovered) { return 'nodeHoveredSelected.dark'; } if (isSelected) { return 'nodeSelected.dark'; } if (isHovered) { return 'nodeHovered.dark'; } return undefined; }, [isHovered, isSelected]); return ( ); }; export default memo(SelectionOverlay);