aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js
diff options
context:
space:
mode:
authorMathieu Suen <mathieu.suen@sonarsource.com>2022-10-10 13:43:22 +0200
committersonartech <sonartech@sonarsource.com>2022-10-12 20:03:43 +0000
commit4494b976a6b79c27f974e27e9cbc51343add47de (patch)
tree582e80a15421c36d3c9a7c6d1ea7528be4e05be6 /server/sonar-web/src/main/js
parent04a7ea7ed3fd018db21e8a6af6eaf19601fb7ad7 (diff)
downloadsonarqube-4494b976a6b79c27f974e27e9cbc51343add47de.tar.gz
sonarqube-4494b976a6b79c27f974e27e9cbc51343add47de.zip
SONAR-16958 Multiple links have the same programmatic link text but different destinations
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx19
1 files changed, 10 insertions, 9 deletions
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx
index 77b92aa4405..848f1c39496 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx
@@ -18,9 +18,11 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import theme from '../../../app/theme';
+import { ButtonPlain } from '../../../components/controls/buttons';
import PinIcon from '../../../components/icons/PinIcon';
import { WorkspaceContextShape } from '../../../components/workspace/context';
-import { translate } from '../../../helpers/l10n';
+import { translateWithParameters } from '../../../helpers/l10n';
import { BranchLike } from '../../../types/branch-like';
import { ComponentMeasure } from '../../../types/types';
@@ -31,9 +33,7 @@ interface Props {
}
export default class ComponentPin extends React.PureComponent<Props> {
- handleClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
- event.preventDefault();
- event.currentTarget.blur();
+ handleClick = () => {
this.props.openComponent({
branchLike: this.props.branchLike,
key: this.props.component.key,
@@ -43,14 +43,15 @@ export default class ComponentPin extends React.PureComponent<Props> {
};
render() {
+ const { name } = this.props.component;
return (
- <a
+ <ButtonPlain
className="link-no-underline"
- href="#"
+ preventDefault={true}
onClick={this.handleClick}
- title={translate('component_viewer.open_in_workspace')}>
- <PinIcon />
- </a>
+ title={translateWithParameters('component_viewer.open_in_workspace_X', name)}>
+ <PinIcon fill={theme.colors.primary} />
+ </ButtonPlain>
);
}
}