import * as React from 'react'; import { Wrapper } from './styled'; export interface FrameViewProps { /** A flag that determines whether the card is selected in edit mode. */ isSelected?: boolean; /** A flag that determines whether the card needs a backgorund or not */ withoutBackground?: boolean; children?: React.ReactNode; link?: string; /** The optional click handler */ onClick?: () => void; } export class Frame extends React.Component { handleClick = (event: React.MouseEvent) => { const { onClick } = this.props; if (onClick) { event.preventDefault(); event.stopPropagation(); onClick(); } }; 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, children, onClick, link, withoutBackground, } = this.props; const isInteractive = Boolean(onClick); return ( {children} ); } }