// @flow import * as React from 'react'; import { withRouter } from 'react-router-dom'; import { MoreIcon } from 'outline-icons'; import { newDocumentUrl } from 'utils/routeHelpers'; import Document from 'models/Document'; import { DropdownMenu, DropdownMenuItem } from 'components/DropdownMenu'; type Props = { label?: React.Node, history: Object, document: Document, }; class NewChildDocumentMenu extends React.Component { handleNewDocument = () => { const { history, document } = this.props; history.push(newDocumentUrl(document.collection)); }; handleNewChild = () => { const { history, document } = this.props; history.push( `${document.collection.url}/new?parentDocument=${document.id}` ); }; render() { const { label, document, history, ...rest } = this.props; const { collection } = document; return ( } {...rest}> New child document New document in {collection.name} ); } } export default withRouter(NewChildDocumentMenu);