File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import ChartIcon from './ChartIcon'
24
24
import { getChartGroupURL } from './charts.helper'
25
25
import { ChartGroupCardProps } from './charts.types'
26
26
import { getChartGroupSubgroup , getDescriptionTruncate } from './charts.util'
27
+ import { CHART_CARD_MAX_LENGTH } from './constants'
27
28
28
29
export const ChartGroupCard = ( { chartGroup } : ChartGroupCardProps ) => {
29
30
const chartGroupEntries = getChartGroupSubgroup ( chartGroup . chartGroupEntries )
@@ -77,9 +78,18 @@ export const ChartGroupCard = ({ chartGroup }: ChartGroupCardProps) => {
77
78
< div className = "flexbox-col h-166 dc__gap-12 px-20 pt-20 pb-16" >
78
79
< div className = "flexbox" >
79
80
{ chartGroupEntries ?. length ? (
80
- chartGroupEntries . map ( ( chart ) => (
81
- < ChartIcon icon = { chart . chartMetaData . icon } key = { chart . id } isChartGroupCard />
82
- ) )
81
+ < >
82
+ { chartGroupEntries . map ( ( chart ) => (
83
+ < ChartIcon icon = { chart . chartMetaData . icon } key = { chart . id } isChartGroupCard />
84
+ ) ) }
85
+ { chartGroup . chartGroupEntries . length > CHART_CARD_MAX_LENGTH && (
86
+ < div className = "chart-group-card__icon-wrapper border__secondary-translucent bg__secondary br-8 p-8 dc__w-fit-content h-50" >
87
+ < span className = "fs-20 lh-1-5 cn-8" >
88
+ +{ chartGroup . chartGroupEntries . length - CHART_CARD_MAX_LENGTH }
89
+ </ span >
90
+ </ div >
91
+ ) }
92
+ </ >
83
93
) : (
84
94
< div className = "dc__border-dashed bg__secondary br-8 p-8 dc__w-fit-content h-50" >
85
95
< Icon name = "ic-folder-color" size = { 32 } color = { null } />
Original file line number Diff line number Diff line change 16
16
17
17
import { Icon } from '@devtron-labs/devtron-fe-common-lib'
18
18
import { ChartDescriptionTypes , ChartGroupEntry } from './charts.types'
19
+ import { CHART_CARD_MAX_LENGTH } from './constants'
19
20
20
21
export const PaginationParams = {
21
22
pageOffset : 0 ,
@@ -50,7 +51,7 @@ export const renderDeprecatedWarning = () => {
50
51
51
52
export const getChartGroupSubgroup = ( chartGroupEntries ) : ChartGroupEntry [ ] => {
52
53
let len = chartGroupEntries . length
53
- len = len < 4 ? len : 4
54
+ len = len < CHART_CARD_MAX_LENGTH ? len : CHART_CARD_MAX_LENGTH
54
55
return chartGroupEntries . slice ( 0 , len )
55
56
}
56
57
Original file line number Diff line number Diff line change @@ -47,3 +47,5 @@ export const QueryParams = {
47
47
SearchKey : 'searchKey' ,
48
48
ChartCategoryId : 'chartCategoryId' ,
49
49
}
50
+
51
+ export const CHART_CARD_MAX_LENGTH = 4
You can’t perform that action at this time.
0 commit comments