Add tooltip to shortlinks on repository overview

This commit is contained in:
Florian Scholdei
2020-11-24 17:34:21 +01:00
parent 2645b0b066
commit 669cc39fa9
4 changed files with 74 additions and 8 deletions

View File

@@ -25,10 +25,12 @@ import React from "react";
import { Link } from "react-router-dom";
import styled from "styled-components";
import { Icon } from "@scm-manager/ui-components";
import Tooltip from "../Tooltip";
type Props = {
to: string;
icon: string;
tooltip?: string;
};
const PointerEventsLink = styled(Link)`
@@ -37,10 +39,20 @@ const PointerEventsLink = styled(Link)`
class RepositoryEntryLink extends React.Component<Props> {
render() {
const { to, icon } = this.props;
const { to, icon, tooltip } = this.props;
let content = <Icon className="fa-lg" name={icon} color="inherit" />;
if (tooltip) {
content = (
<Tooltip message={tooltip} location="top">
{content}
</Tooltip>
);
}
return (
<PointerEventsLink className="level-item" to={to}>
<Icon className="fa-lg" name={icon} color="inherit" />
{content}
</PointerEventsLink>
);
}