import React from 'react'; import PropTypes from 'prop-types'; import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; import { Container, NgIf, Icon } from '../../components/'; import './menubar.scss'; export const MenuBar = (props) => { return (
{props.title}
{props.children} { props.download === null ? null : }
); }; class DownloadButton extends React.Component { constructor(props){ super(props); this.state = { loading: false, id: null }; } onDownloadRequest(){ this.setState({ loading: true }); document.cookie = "download=yes; path=/; max-age=120;"; this.state.id = window.setInterval(() => { if(/download=yes/.test(document.cookie) === false){ window.clearInterval(this.state.id); this.setState({loading: false}); } }, 100); } componentWillUnmount(){ window.clearInterval(this.state.id); } render(){ return ( ); } } DownloadButton.PropTypes = { link: PropTypes.string.isRequired, name: PropTypes.string.isRequired };