changed BranchView component to container and simplified BranchTable with new BranchRow

This commit is contained in:
Florian Scholdei
2019-03-29 10:02:53 +01:00
parent fe510d592a
commit 07948b51a8
4 changed files with 62 additions and 23 deletions

View File

@@ -0,0 +1,25 @@
// @flow
import React from "react";
import { Link } from "react-router-dom";
import type { Branch } from "@scm-manager/ui-types";
type Props = {
baseUrl: string,
branch: Branch
};
export default class BranchRow extends React.Component<Props> {
renderLink(to: string, label: string) {
return <Link to={to}>{label} <span className="tag is-dark">Default</span></Link>;
}
render() {
const { baseUrl, branch } = this.props;
const to = `${baseUrl}/${encodeURIComponent(branch.name)}/info`;
return (
<tr>
<td>{this.renderLink(to, branch.name)}</td>
</tr>
);
}
}