({children, maxLines = 6, ...props}: TruncatedCodeProps)
| 194 | } |
| 195 | |
| 196 | function TruncatedCode({children, maxLines = 6, ...props}: TruncatedCodeProps) { |
| 197 | let lines = children.split('\n'); |
| 198 | return lines.length > maxLines ? ( |
| 199 | <ExpandableCode hasHighlightedLine={/- begin (highlight|focus)/.test(children)}> |
| 200 | <Pre> |
| 201 | <Code {...props}>{children}</Code> |
| 202 | </Pre> |
| 203 | </ExpandableCode> |
| 204 | ) : ( |
| 205 | <div |
| 206 | className={style({ |
| 207 | overflow: 'auto', |
| 208 | '--code-padding-end': { |
| 209 | type: 'paddingEnd', |
| 210 | value: 64 // Extra space for the toolbar |
| 211 | } |
| 212 | })}> |
| 213 | <Pre> |
| 214 | <Code {...props}>{children}</Code> |
| 215 | </Pre> |
| 216 | </div> |
| 217 | ); |
| 218 | } |
| 219 | |
| 220 | interface FilesProps { |
| 221 | children?: ReactNode; |
nothing calls this directly
no outgoing calls
no test coverage detected