refactoring of buttons to navLinks

This commit is contained in:
Maren Süwer
2018-07-26 09:49:44 +02:00
parent 0d551de147
commit 1158802492
9 changed files with 78 additions and 88 deletions

View File

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