1
+ import ChevronRightIcon from "@mui/icons-material/ChevronRight" ;
1
2
import {
2
3
Card ,
3
4
CardContent ,
@@ -8,12 +9,14 @@ import {
8
9
ListItem ,
9
10
ListItemButton ,
10
11
ListItemText ,
12
+ Paper ,
11
13
Stack ,
12
14
Tooltip ,
13
15
Typography ,
14
16
} from "@mui/material" ;
15
17
import { Box } from "@mui/system" ;
16
18
import Link from "next/link" ;
19
+ import ReactMarkdown from "react-markdown" ;
17
20
18
21
// ============================
19
22
// Styles (centralized)
@@ -38,6 +41,7 @@ export interface BenchmarkLinkItem {
38
41
name : string ;
39
42
route : string ;
40
43
description ?: string ;
44
+ info ?: string ;
41
45
keys ?: string [ ] ;
42
46
actions ?: {
43
47
label : string ;
@@ -81,15 +85,31 @@ function BenchmarkCardItem({
81
85
} ;
82
86
83
87
return (
84
- < ListItem key = { it . route } disablePadding >
85
- < Box sx = { { width : "100%" } } >
88
+ < ListItem key = { it . route } disablePadding sx = { { mb : 1 } } >
89
+ < Paper
90
+ variant = "outlined"
91
+ sx = { {
92
+ p : 1 ,
93
+ width : "100%" ,
94
+ borderRadius : 2 ,
95
+ overflow : "hidden" ,
96
+ borderColor : "divider" ,
97
+ "&:hover" : {
98
+ boxShadow : 3 ,
99
+ borderColor : "primary.main" ,
100
+ } ,
101
+ } }
102
+ >
86
103
< Tooltip title = "Go to Main Page" arrow >
87
104
< ListItemButton { ...buttonProps } >
88
105
< ListItemText
89
106
primary = {
90
- < Typography variant = "subtitle1" >
91
- { highlight ( it . name , query ) }
92
- </ Typography >
107
+ < Stack direction = "row" alignItems = "center" spacing = { 1 } >
108
+ < Typography variant = "h6" color = "primary" >
109
+ { highlight ( it . name , query ) }
110
+ </ Typography >
111
+ < ChevronRightIcon fontSize = "small" />
112
+ </ Stack >
93
113
}
94
114
secondary = {
95
115
it . description ?. length ? (
@@ -100,50 +120,77 @@ function BenchmarkCardItem({
100
120
</ ListItemButton >
101
121
</ Tooltip >
102
122
103
- { /* Actions */ }
123
+ { it . info ? (
124
+ < Stack
125
+ spacing = { 1 }
126
+ sx = { { px : 2 , pb : 1 , pt : 0.5 } }
127
+ direction = "row"
128
+ alignItems = "center"
129
+ >
130
+ < Typography variant = "subtitle1" > Details:</ Typography >
131
+ < Typography
132
+ variant = "subtitle1"
133
+ color = "text.secondary"
134
+ sx = { {
135
+ "& p" : { margin : 0 , lineHeight : 1.2 } ,
136
+ "& ul, & ol" : { margin : 0 , paddingLeft : "1.2rem" } ,
137
+ "& li" : { margin : 0 , lineHeight : 1.2 } ,
138
+ } }
139
+ >
140
+ < MarkdownText text = { it . info } />
141
+ </ Typography >
142
+ </ Stack >
143
+ ) : null }
144
+
104
145
{ it . actions && (
105
- < Stack direction = "row" spacing = { 1 } sx = { { px : 2 , pb : 1 , pt : 0.5 } } >
106
- { it . actions . map ( ( a , idx ) => {
107
- if ( ! a . href ) {
108
- // non-link action (local click)
146
+ < Box sx = { { px : 2 , pb : 1 , pt : 0.5 } } >
147
+ < Stack direction = "row" spacing = { 1 } alignItems = "center" >
148
+ < Typography variant = "subtitle1" > Pages:</ Typography >
149
+ { it . actions . map ( ( a , idx ) => {
150
+ if ( ! a . href ) {
151
+ return (
152
+ < Chip
153
+ key = { idx }
154
+ clickable
155
+ size = "small"
156
+ color = "secondary"
157
+ label = { a . label }
158
+ onClick = { a . onClick }
159
+ />
160
+ ) ;
161
+ }
162
+ const linkProps = isExternal ( a . href )
163
+ ? {
164
+ component : "a" as const ,
165
+ href : a . href ,
166
+ target : "_blank" ,
167
+ rel : "noopener noreferrer" ,
168
+ }
169
+ : {
170
+ component : Link as any ,
171
+ href : a . href ,
172
+ prefetch : false ,
173
+ } ;
109
174
return (
110
175
< Chip
176
+ { ...linkProps }
111
177
key = { idx }
112
178
clickable
113
179
size = "small"
114
- color = "secondary"
115
- label = { a . label }
116
- onClick = { a . onClick }
180
+ color = "primary"
181
+ label = {
182
+ < Stack direction = "row" alignItems = "center" spacing = { 0.5 } >
183
+ < span > { a . label } </ span >
184
+ < ChevronRightIcon fontSize = "small" />
185
+ </ Stack >
186
+ }
117
187
/>
118
188
) ;
119
- }
120
- const linkProps = isExternal ( a . href )
121
- ? {
122
- component : "a" as const ,
123
- href : a . href ,
124
- target : "_blank" ,
125
- rel : "noopener noreferrer" ,
126
- }
127
- : {
128
- component : Link as any ,
129
- href : a . href ,
130
- // optional Next.js tweaks:
131
- prefetch : false ,
132
- } ;
133
- return (
134
- < Chip
135
- { ...linkProps }
136
- key = { idx }
137
- clickable
138
- size = "small"
139
- color = "primary"
140
- label = { a . label }
141
- />
142
- ) ;
143
- } ) }
144
- </ Stack >
189
+ } ) }
190
+ </ Stack >
191
+ </ Box >
145
192
) }
146
- </ Box >
193
+ </ Paper >
147
194
</ ListItem >
148
195
) ;
149
196
}
@@ -185,16 +232,11 @@ export function BenchmarkCategoryCard({
185
232
...( it . actions ?? [ ] ) , // keep existing actions if any
186
233
] ;
187
234
return (
188
- < >
189
- < BenchmarkCardItem
190
- key = { it . route }
191
- it = { { ...it , actions } }
192
- query = { query }
193
- />
194
- { index < cat . items . length - 1 && (
195
- < Divider key = { `divider-${ index } ` } />
196
- ) }
197
- </ >
235
+ < BenchmarkCardItem
236
+ key = { it . route }
237
+ it = { { ...it , actions } }
238
+ query = { query }
239
+ />
198
240
) ;
199
241
} ) }
200
242
</ List >
@@ -236,3 +278,7 @@ function highlight(text: string, q: string) {
236
278
}
237
279
238
280
const isExternal = ( url : string ) => / ^ h t t p s ? : \/ \/ / i. test ( url ) ;
281
+
282
+ export function MarkdownText ( { text } : { text : string } ) {
283
+ return < ReactMarkdown > { text } </ ReactMarkdown > ;
284
+ }
0 commit comments