Files
SCM-Manager/scm-ui/ui-webapp/src/repos/branches/components/BranchRow.js

33 lines
756 B
JavaScript
Raw Normal View History

// @flow
import React from "react";
import { Link } from "react-router-dom";
import type { Branch } from "@scm-manager/ui-types";
2019-04-03 08:52:29 +02:00
import DefaultBranchTag from "./DefaultBranchTag";
type Props = {
baseUrl: string,
2019-04-03 08:52:29 +02:00
branch: Branch
};
class BranchRow extends React.Component<Props> {
renderLink(to: string, label: string, defaultBranch?: boolean) {
return (
<Link to={to}>
2019-04-03 08:52:29 +02:00
{label} <DefaultBranchTag defaultBranch={defaultBranch} />
</Link>
);
}
render() {
const { baseUrl, branch } = this.props;
const to = `${baseUrl}/${encodeURIComponent(branch.name)}/info`;
2019-04-03 08:52:29 +02:00
return (
<tr>
<td>{this.renderLink(to, branch.name, branch.defaultBranch)}</td>
</tr>
);
}
}
2019-04-03 08:52:29 +02:00
export default BranchRow;