File tree Expand file tree Collapse file tree 6 files changed +67
-44
lines changed
catalog/src/components/CatalogSearchResultListItem
search-react/src/components/DefaultResultListItem
stack-overflow/src/search/StackOverflowSearchResultListItem
techdocs/src/search/components Expand file tree Collapse file tree 6 files changed +67
-44
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @backstage/plugin-adr ' : patch
3
+ ' @backstage/plugin-catalog ' : patch
4
+ ' @backstage/plugin-search-react ' : patch
5
+ ' @backstage/plugin-stack-overflow ' : patch
6
+ ' @backstage/plugin-techdocs ' : patch
7
+ ---
8
+
9
+ Update search links to only have header as linkable text
Original file line number Diff line number Diff line change @@ -64,20 +64,24 @@ export function AdrSearchResultListItem(props: {
64
64
} ;
65
65
66
66
return (
67
- < Link noTrack to = { result . location } onClick = { handleClick } >
67
+ < >
68
68
< ListItem alignItems = "flex-start" className = { classes . flexContainer } >
69
69
< ListItemText
70
70
className = { classes . itemText }
71
71
primaryTypographyProps = { { variant : 'h6' } }
72
72
primary = {
73
73
highlight ?. fields . title ? (
74
- < HighlightedSearchResultText
75
- text = { highlight . fields . title }
76
- preTag = { highlight . preTag }
77
- postTag = { highlight . postTag }
78
- />
74
+ < Link noTrack to = { result . location } onClick = { handleClick } >
75
+ < HighlightedSearchResultText
76
+ text = { highlight . fields . title }
77
+ preTag = { highlight . preTag }
78
+ postTag = { highlight . postTag }
79
+ />
80
+ </ Link >
79
81
) : (
80
- result . title
82
+ < Link noTrack to = { result . location } onClick = { handleClick } >
83
+ { result . title }
84
+ </ Link >
81
85
)
82
86
}
83
87
secondary = {
@@ -116,6 +120,6 @@ export function AdrSearchResultListItem(props: {
116
120
</ Box >
117
121
</ ListItem >
118
122
< Divider component = "li" />
119
- </ Link >
123
+ </ >
120
124
) ;
121
125
}
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ export function CatalogSearchResultListItem(
71
71
} ;
72
72
73
73
return (
74
- < Link noTrack to = { result . location } onClick = { handleClick } >
74
+ < >
75
75
< ListItem alignItems = "flex-start" >
76
76
{ props . icon && < ListItemIcon > { props . icon } </ ListItemIcon > }
77
77
< div className = { classes . flexContainer } >
@@ -80,13 +80,17 @@ export function CatalogSearchResultListItem(
80
80
primaryTypographyProps = { { variant : 'h6' } }
81
81
primary = {
82
82
props . highlight ?. fields . title ? (
83
- < HighlightedSearchResultText
84
- text = { props . highlight . fields . title }
85
- preTag = { props . highlight . preTag }
86
- postTag = { props . highlight . postTag }
87
- />
83
+ < Link noTrack to = { result . location } onClick = { handleClick } >
84
+ < HighlightedSearchResultText
85
+ text = { props . highlight . fields . title }
86
+ preTag = { props . highlight . preTag }
87
+ postTag = { props . highlight . postTag }
88
+ />
89
+ </ Link >
88
90
) : (
89
- result . title
91
+ < Link noTrack to = { result . location } onClick = { handleClick } >
92
+ { result . title }
93
+ </ Link >
90
94
)
91
95
}
92
96
secondary = {
@@ -112,6 +116,6 @@ export function CatalogSearchResultListItem(
112
116
</ div >
113
117
</ ListItem >
114
118
< Divider component = "li" />
115
- </ Link >
119
+ </ >
116
120
) ;
117
121
}
Original file line number Diff line number Diff line change @@ -66,20 +66,24 @@ export const DefaultResultListItemComponent = ({
66
66
} ;
67
67
68
68
return (
69
- < Link noTrack to = { result . location } onClick = { handleClick } >
69
+ < >
70
70
< ListItem alignItems = "center" >
71
71
{ icon && < ListItemIcon > { icon } </ ListItemIcon > }
72
72
< ListItemText
73
73
primaryTypographyProps = { { variant : 'h6' } }
74
74
primary = {
75
75
highlight ?. fields . title ? (
76
- < HighlightedSearchResultText
77
- text = { highlight . fields . title }
78
- preTag = { highlight . preTag }
79
- postTag = { highlight . postTag }
80
- />
76
+ < Link noTrack to = { result . location } onClick = { handleClick } >
77
+ < HighlightedSearchResultText
78
+ text = { highlight . fields . title }
79
+ preTag = { highlight . preTag }
80
+ postTag = { highlight . postTag }
81
+ />
82
+ </ Link >
81
83
) : (
82
- result . title
84
+ < Link noTrack to = { result . location } onClick = { handleClick } >
85
+ { result . title }
86
+ </ Link >
83
87
)
84
88
}
85
89
secondary = {
@@ -106,7 +110,7 @@ export const DefaultResultListItemComponent = ({
106
110
{ secondaryAction && < Box alignItems = "flex-end" > { secondaryAction } </ Box > }
107
111
</ ListItem >
108
112
< Divider />
109
- </ Link >
113
+ </ >
110
114
) ;
111
115
} ;
112
116
Original file line number Diff line number Diff line change @@ -47,13 +47,17 @@ export const StackOverflowSearchResultListItem = (
47
47
} ;
48
48
49
49
return (
50
- < Link to = { location } noTrack onClick = { handleClick } >
50
+ < >
51
51
< ListItem alignItems = "center" >
52
52
{ props . icon && < ListItemIcon > { props . icon } </ ListItemIcon > }
53
53
< Box flexWrap = "wrap" >
54
54
< ListItemText
55
55
primaryTypographyProps = { { variant : 'h6' } }
56
- primary = { _unescape ( title ) }
56
+ primary = {
57
+ < Link to = { location } noTrack onClick = { handleClick } >
58
+ { _unescape ( title ) }
59
+ </ Link >
60
+ }
57
61
secondary = { `Author: ${ text } ` }
58
62
/>
59
63
< Chip label = { `Answer(s): ${ answers } ` } size = "small" />
@@ -64,6 +68,6 @@ export const StackOverflowSearchResultListItem = (
64
68
</ Box >
65
69
</ ListItem >
66
70
< Divider />
67
- </ Link >
71
+ </ >
68
72
) ;
69
73
} ;
Original file line number Diff line number Diff line change @@ -81,6 +81,15 @@ export const TechDocsSearchResultListItem = (
81
81
} ) ;
82
82
} ;
83
83
84
+ const LinkWrapper = ( { children } : PropsWithChildren < { } > ) =>
85
+ asLink ? (
86
+ < Link noTrack to = { result . location } onClick = { handleClick } >
87
+ { children }
88
+ </ Link >
89
+ ) : (
90
+ < > { children } </ >
91
+ ) ;
92
+
84
93
const TextItem = ( ) => {
85
94
const resultTitle = highlight ?. fields . title ? (
86
95
< HighlightedSearchResultText
@@ -118,11 +127,11 @@ export const TechDocsSearchResultListItem = (
118
127
primaryTypographyProps = { { variant : 'h6' } }
119
128
primary = {
120
129
title ? (
121
- title
130
+ < LinkWrapper > { title } </ LinkWrapper >
122
131
) : (
123
- < >
132
+ < LinkWrapper >
124
133
{ resultTitle } | { entityTitle ?? resultName } docs
125
- </ >
134
+ </ LinkWrapper >
126
135
)
127
136
}
128
137
secondary = {
@@ -149,15 +158,6 @@ export const TechDocsSearchResultListItem = (
149
158
) ;
150
159
} ;
151
160
152
- const LinkWrapper = ( { children } : PropsWithChildren < { } > ) =>
153
- asLink ? (
154
- < Link noTrack to = { result . location } onClick = { handleClick } >
155
- { children }
156
- </ Link >
157
- ) : (
158
- < > { children } </ >
159
- ) ;
160
-
161
161
const ListItemWrapper = ( { children } : PropsWithChildren < { } > ) =>
162
162
asListItem ? (
163
163
< >
@@ -172,10 +172,8 @@ export const TechDocsSearchResultListItem = (
172
172
) ;
173
173
174
174
return (
175
- < LinkWrapper >
176
- < ListItemWrapper >
177
- < TextItem />
178
- </ ListItemWrapper >
179
- </ LinkWrapper >
175
+ < ListItemWrapper >
176
+ < TextItem />
177
+ </ ListItemWrapper >
180
178
) ;
181
179
} ;
You can’t perform that action at this time.
0 commit comments