diff --git a/scm-ui-components/packages/ui-components/src/OverviewPageActions.js b/scm-ui-components/packages/ui-components/src/OverviewPageActions.js new file mode 100644 index 0000000000..f4861fccc0 --- /dev/null +++ b/scm-ui-components/packages/ui-components/src/OverviewPageActions.js @@ -0,0 +1,63 @@ +// @flow +import React from "react"; +import type { History } from "history"; +import { withRouter } from "react-router-dom"; +import classNames from "classnames"; +import injectSheet from "react-jss"; +import { PageActions } from "./layout"; +import { FilterInput } from "./forms"; +import { Button, urls } from "./index"; + +type Props = { + showCreateButton: boolean, + link: string, + label?: string, + + // context props + classes: Object, + history: History, + location: any +}; + +const styles = { + button: { + float: "right", + marginTop: "1.25rem", + marginLeft: "1.25rem" + } +}; + +class OverviewPageActions extends React.Component { + render() { + const { history, location, link } = this.props; + return ( + + { + history.push(`/${link}/?q=${filter}`); + }} + /> + {this.renderCreateButton()} + + ); + } + + renderCreateButton() { + const { showCreateButton, classes, link, label } = this.props; + if (showCreateButton) { + return ( +
+
+ ); + } + return null; + } +} + +export default injectSheet(styles)(withRouter(OverviewPageActions));