File tree 1 file changed +36
-0
lines changed
client/packages/lowcoder/src/pages/setting/audit/components
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ import Statistic from "antd/es/statistic" ;
2
+ import { AuditLogStat } from "../auditContants" ;
3
+ import Card from "antd/es/card" ;
4
+ import styled from "styled-components" ;
5
+ import { useMemo } from "react" ;
6
+
7
+ const StyledStatistics = styled ( Statistic ) `
8
+ .ant-statistic-title {
9
+ font-size: 12px;
10
+ }
11
+ .ant-statistic-content {
12
+ font-size: 20px;
13
+ }
14
+ ` ;
15
+
16
+ const Statistics = ( { stats } : { stats : AuditLogStat [ ] } ) => {
17
+ const width = useMemo ( ( ) => {
18
+ if ( stats . length < 5 ) return `${ 100 / stats . length } %` ;
19
+ return '20%' ;
20
+ } , [ stats . length ] ) ;
21
+
22
+ return (
23
+ < Card size = "small" variant = "borderless" style = { { marginBottom : '20px' } } >
24
+ { stats . map ( stat => (
25
+ < Card . Grid hoverable = { false } style = { { width, padding : '12px' } } >
26
+ < StyledStatistics
27
+ title = { stat . eventType . split ( '_' ) . join ( ' ' ) }
28
+ value = { stat . groupCountResult }
29
+ />
30
+ </ Card . Grid >
31
+ ) ) }
32
+ </ Card >
33
+ )
34
+ }
35
+
36
+ export default Statistics ;
You can’t perform that action at this time.
0 commit comments