11import semver from 'semver' ;
2- import { Box , Link , Tooltip , styled } from '@material-ui/core' ;
3- import LaunchOutlinedIcon from '@material-ui/icons/LaunchOutlined' ;
2+ import { Box , Tooltip , styled } from '@material-ui/core' ;
43import ReportProblemOutlined from '@material-ui/icons/ReportProblemOutlined' ;
54import MiddleEllipsis from 'react-middle-ellipsis' ;
65import { getCommitURL , getReleaseNotesURL } from '../../utils/helpers' ;
76import { ColorWrapper } from '../ColorWrapper' ;
7+ import { ExternalLink } from '@giantswarm/backstage-plugin-ui-react' ;
88
99const StyledReportProblemOutlined = styled ( ReportProblemOutlined ) (
1010 ( { theme } ) => ( {
@@ -14,21 +14,6 @@ const StyledReportProblemOutlined = styled(ReportProblemOutlined)(
1414 } ) ,
1515) ;
1616
17- // Block-level flex link so the width constraint chain works for MiddleEllipsis truncation.
18- // ExternalLink uses inline-flex which breaks percentage-based maxWidth resolution.
19- const StyledLink = styled ( Link ) ( {
20- display : 'flex' ,
21- alignItems : 'center' ,
22- overflow : 'hidden' ,
23- minWidth : 0 ,
24- } ) ;
25-
26- const StyledLaunchOutlinedIcon = styled ( LaunchOutlinedIcon ) ( ( { theme } ) => ( {
27- marginLeft : theme . spacing ( 0.5 ) ,
28- fontSize : 'inherit' ,
29- flexShrink : 0 ,
30- } ) ) ;
31-
3217const COMMIT_HASH_REGEXP = / \b [ 0 - 9 a - f ] { 40 } \b / ;
3318const INVALID_VERSION = 'n/a' ;
3419
@@ -213,18 +198,21 @@ export const Version = ({
213198 maxWidth = { truncate ? '100%' : undefined }
214199 >
215200 { displayLinkToProject ? (
216- < StyledLink
217- href = {
218- commitHash
219- ? getCommitURL ( sourceLocation , commitHash )
220- : getReleaseNotesURL ( sourceLocation , versionLabel )
221- }
222- target = "_blank"
223- rel = "noopener noreferrer"
201+ < Box
202+ overflow = { truncate ? 'hidden' : undefined }
203+ minWidth = { truncate ? 0 : undefined }
224204 >
225- { versionComponent }
226- < StyledLaunchOutlinedIcon />
227- </ StyledLink >
205+ < ExternalLink
206+ href = {
207+ commitHash
208+ ? getCommitURL ( sourceLocation , commitHash )
209+ : getReleaseNotesURL ( sourceLocation , versionLabel )
210+ }
211+ display = { truncate ? 'flex' : 'inline-flex' }
212+ >
213+ { versionComponent }
214+ </ ExternalLink >
215+ </ Box >
228216 ) : (
229217 versionComponent
230218 ) }
0 commit comments