import * as React from 'react'; import { Wrappper } from './styled'; export interface CollapsedFrameProps { minWidth?: number; maxWidth?: number; children?: React.ReactNode; /** The optional click handler */ onClick?: () => void; /** A flag that determines whether the card is selected in edit mode. */ isSelected?: boolean; } export class CollapsedFrame extends React.Component { handleClick = (event: React.MouseEvent) => { const { onClick } = this.props; if (onClick) { event.preventDefault(); event.stopPropagation(); onClick(); } }; // imitate a button for accessibility reasons handleKeyPress = (event: React.KeyboardEvent) => { if (event.key !== ' ' && event.key !== 'Enter') { return; } const { onClick } = this.props; if (onClick) { event.preventDefault(); event.stopPropagation(); onClick(); } }; render() { const { isSelected, minWidth, maxWidth, children, onClick } = this.props; const isInteractive = Boolean(onClick); return ( {children} ); } }