{"size": 534, "ext": "js", "max_stars_repo_path": "src/views/Modal.js", "max_stars_repo_name": "lorenzofox3/d-", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/views/Modal.js", "max_issues_repo_name": "lorenzofox3/d-", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/views/Modal.js", "max_forks_repo_name": "lorenzofox3/d-", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.2727272727, "max_line_length": 81, "alphanum_fraction": 0.5842696629}
import {h} from 'flaco';
import {Cross} from '../components/icons';

const modal = Comp => props => {
  const {isOpen, closeModal, title} = props;
  const onKeyDown = ({code}) => {
    if (code === 'Escape') {
      closeModal();
    }
  };

  return (<div aria-hidden={String(!isOpen)} onKeyDown={onKeyDown} class="modal">
    <header>
      <h2>{title}</h2>
      <button onClick={closeModal}><Cross></Cross></button>
    </header>
    <div class="blurry-background"></div>
    <Comp {...props}/>
  </div>)
};

export default modal;