File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
spicecloud/pages/components Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { styles } from '../utils/styles' ;
3+
4+ interface Props {
5+ averageComplexity ?: string ;
6+ distribution ?: Record < string , number > ;
7+ totalFunctions ?: number ;
8+ }
9+
10+ export const ComplexityCard : React . FC < Props > = ( {
11+ averageComplexity = 'N/A' ,
12+ distribution,
13+ totalFunctions,
14+ } ) => {
15+ return (
16+ < div style = { styles . metricCard } className = "metric-card" >
17+ < div style = { styles . metricHeader } >
18+ < h3 style = { styles . metricTitle } > Complexity</ h3 >
19+ < span style = { styles . metricValue } > { averageComplexity } </ span >
20+ </ div >
21+
22+ < div style = { styles . metricDetails } >
23+ { totalFunctions !== undefined && (
24+ < p style = { styles . detailLine } >
25+ Functions analysed: { totalFunctions }
26+ </ p >
27+ ) }
28+ { distribution &&
29+ Object . entries ( distribution ) . map ( ( [ bigO , qty ] ) => (
30+ < p key = { bigO } style = { styles . detailLine } >
31+ { bigO } : { qty }
32+ </ p >
33+ ) ) }
34+ </ div >
35+ </ div >
36+ ) ;
37+ } ;
You can’t perform that action at this time.
0 commit comments