mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
refactoring of buttons to navLinks
This commit is contained in:
28
scm-ui/src/users/components/navLinks/EditUserNavLink.js
Normal file
28
scm-ui/src/users/components/navLinks/EditUserNavLink.js
Normal 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);
|
||||
Reference in New Issue
Block a user