import * as React from 'react' ; import IReactComponentProps from '../../../common/structures/IReactComponentProps' ; import classnames from 'classnames' ; import CloseBigSVG from '../../../svg/close--big.svg' ; import * as styles from './Close.scss' ; import { FunctionGeneric } from '../../../common/structures/Generics' ; interface IProps extends IReactComponentProps { position ? : 'absolute' | 'static' ; onClick : FunctionGeneric ; } export default class Close extends React . Component < IProps > { static defaultProps : Partial < IProps > = { position : 'absolute' , } ; onKeyDown = ( event ) => { if ( event . key === 'Enter' ) { event . target . click ( ) ; } } ; render ( ) { return ( < span tabIndex = { 0 } className = { classnames ( styles . Close , 'Close' , { [ styles . Close__PositionAbsolute ] : this . props . position === 'absolute' , } , this . props . className ) } id = { this . props . id } onClick = { this . props . onClick } onKeyDown = { this . onKeyDown } style = { this . props . style } > < CloseBigSVG /> < /span>); } }