Skip to content

Commit

Permalink
implement check for github url
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Collins authored and Chris Collins committed Oct 20, 2022
1 parent 6ba29b1 commit d893e26
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion datahub-web-react/src/app/entity/shared/ExternalUrlButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import styled from 'styled-components/macro';
import { EntityType } from '../../../types.generated';
import analytics, { EventType, EntityActionType } from '../../analytics';

const GITHUB_LINK = 'github.com';
const GITHUB = 'GitHub';

const ExternalUrlWrapper = styled.span`
font-size: 12px;
`;
Expand Down Expand Up @@ -37,6 +40,11 @@ export default function ExternalUrlButton({ externalUrl, platformName, entityTyp
});
}

let displayedName = platformName;
if (externalUrl.toLocaleLowerCase().includes(GITHUB_LINK)) {
displayedName = GITHUB;
}

return (
<ExternalUrlWrapper>
<StyledButton
Expand All @@ -46,7 +54,7 @@ export default function ExternalUrlButton({ externalUrl, platformName, entityTyp
rel="noreferrer noopener"
onClick={sendAnalytics}
>
View in {platformName} <ArrowRightOutlined style={{ fontSize: 12 }} />
View in {displayedName} <ArrowRightOutlined style={{ fontSize: 12 }} />
</StyledButton>
</ExternalUrlWrapper>
);
Expand Down

0 comments on commit d893e26

Please sign in to comment.