Added EditGroupNavLink

This commit is contained in:
Philipp Czora
2018-08-02 09:29:28 +02:00
parent a5d6ff3110
commit df11cdc332
4 changed files with 65 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
//@flow
import React from 'react';
import NavLink from "../../../components/navigation/NavLink";
import { translate } from "react-i18next";
import type { Group } from "../../types/Group";
type Props = {
t: string => string,
editUrl: string,
group: Group
}
type State = {
}
class EditGroupNavLink extends React.Component<Props, State> {
render() {
const { t, editUrl } = this.props;
if (!this.isEditable()) {
return null;
}
return <NavLink label={t("edit-group-button.label")} to={editUrl} />;
}
isEditable = () => {
return this.props.group._links.update;
}
}
export default translate("groups")(EditGroupNavLink);