import * as classNames from 'classnames'; import * as React from 'react'; import { CSSTransition, TransitionGroup } from 'react-transition-group'; import { OptionalComponentPropAndHTMLAttributes } from '../../types'; export type HighlightProps = { /** * Displays the overlay * @default false */ open?: boolean; /** * Disables any interactions with highlighted area * @default false */ disabled?: boolean; /** * Background colour * @default undefined */ backgroundColor?: string | undefined; } & OptionalComponentPropAndHTMLAttributes; const TIMEOUT = { appear: 300, enter: 300, exit: 200, }; /** * This highlight component is used to display a single element while shading everything else out. */ const Highlight = (props: HighlightProps) => { const { className, children, open = false, disabled = false, backgroundColor = null, component: Component = 'div', ...remainingProps } = props; return ( {open && (
)}
{children} {open && disabled &&
}
); }; export default React.memo(Highlight);