{"size": 590, "ext": "js", "max_stars_repo_path": "src/components/notes.js", "max_stars_repo_name": "SebastiaanNijland/spectacle", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/notes.js", "max_issues_repo_name": "SebastiaanNijland/spectacle", "max_issues_repo_issues_event_min_datetime": "2022-02-19T08:39:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T19:27:18.000Z", "max_forks_repo_path": "src/components/notes.js", "max_forks_repo_name": "devoojs/spectacle", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 4, "max_forks_count": null, "avg_line_length": 29.5, "max_line_length": 70, "alphanum_fraction": 0.7305084746}
import * as React from 'react';
import ReactDOM from 'react-dom';
import propTypes from 'prop-types';
import { DeckContext } from '../components/deck/deck';
import { SlideContext } from '../components/slide/slide';

export default function Notes({ children }) {
  const { notePortalNode } = React.useContext(DeckContext);
  const { isSlideActive } = React.useContext(SlideContext);

  if (!isSlideActive) return null;
  if (!notePortalNode) return null;

  return ReactDOM.createPortal(<div>{children}</div>, notePortalNode);
}

Notes.propTypes = {
  children: propTypes.node.isRequired
};
