Files
SCM-Manager/scm-ui/ui-webapp/src/groups/components/table/GroupRow.tsx

37 lines
939 B
TypeScript
Raw Normal View History

import React from "react";
import { WithTranslation, withTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import { Group } from "@scm-manager/ui-types";
import { Icon } from "@scm-manager/ui-components";
type Props = WithTranslation & {
group: Group;
};
class GroupRow extends React.Component<Props> {
renderLink(to: string, label: string) {
return <Link to={to}>{label}</Link>;
}
render() {
const { group, t } = this.props;
const to = `/group/${group.name}`;
const iconType = group.external ? (
2019-11-20 16:15:08 +01:00
<Icon title={t("group.external")} name="globe-americas" />
) : (
2019-11-20 16:15:08 +01:00
<Icon title={t("group.internal")} name="home" />
);
return (
<tr>
<td>
{iconType} {this.renderLink(to, group.name)}
</td>
<td className="is-hidden-mobile">{group.description}</td>
</tr>
);
}
}
export default withTranslation("groups")(GroupRow);