1- import { Component } from 'react' ;
21import styled from '@emotion/styled' ;
32
43import { trimPackage } from 'sentry/components/events/interfaces/frame/utils' ;
@@ -19,52 +18,47 @@ type Props = {
1918 isHoverPreviewed ?: boolean ;
2019} ;
2120
22- class PackageLink extends Component < Props > {
23- handleClick = ( event : React . MouseEvent < HTMLAnchorElement > ) => {
24- const { isClickable, onClick} = this . props ;
25-
21+ function PackageLink ( {
22+ children,
23+ includeSystemFrames,
24+ isClickable,
25+ isHoverPreviewed,
26+ onClick,
27+ packagePath,
28+ withLeadHint,
29+ } ) {
30+ const handleClick = ( event : React . MouseEvent < HTMLAnchorElement > ) => {
2631 if ( isClickable ) {
2732 onClick ( event ) ;
2833 }
2934 } ;
3035
31- render ( ) {
32- const {
33- packagePath,
34- isClickable,
35- withLeadHint,
36- children,
37- includeSystemFrames,
38- isHoverPreviewed,
39- } = this . props ;
40-
41- return (
42- < Package
43- onClick = { this . handleClick }
44- isClickable = { isClickable }
45- withLeadHint = { withLeadHint }
46- includeSystemFrames = { includeSystemFrames }
47- >
48- { defined ( packagePath ) ? (
49- < Tooltip
50- title = { packagePath }
51- delay = { isHoverPreviewed ? SLOW_TOOLTIP_DELAY : undefined }
36+ return (
37+ < Package
38+ onClick = { handleClick }
39+ isClickable = { isClickable }
40+ withLeadHint = { withLeadHint }
41+ includeSystemFrames = { includeSystemFrames }
42+ >
43+ { defined ( packagePath ) ? (
44+ < Tooltip
45+ title = { packagePath }
46+ delay = { isHoverPreviewed ? SLOW_TOOLTIP_DELAY : undefined }
47+ >
48+ < PackageName
49+ isClickable = { isClickable }
50+ withLeadHint = { withLeadHint }
51+ includeSystemFrames = { includeSystemFrames }
5252 >
53- < PackageName
54- isClickable = { isClickable }
55- withLeadHint = { withLeadHint }
56- includeSystemFrames = { includeSystemFrames }
57- >
58- { trimPackage ( packagePath ) }
59- </ PackageName >
60- </ Tooltip >
61- ) : (
62- < span > { '<unknown>' } </ span >
63- ) }
64- { children }
65- </ Package >
66- ) ;
67- }
53+ { trimPackage ( packagePath ) }
54+ </ PackageName >
55+ </ Tooltip >
56+ ) : (
57+ < span > { '<unknown>' } </ span >
58+ ) }
59+ { children }
60+ </ Package >
61+ ) ;
6862}
6963
7064export const Package = styled ( 'a' ) < Partial < Props >> `
0 commit comments