Skip to content

Commit f922ab1

Browse files
committed
chore: chart card code feedback
1 parent f0d4f14 commit f922ab1

File tree

2 files changed

+22
-27
lines changed

2 files changed

+22
-27
lines changed

src/components/charts/ChartCard.tsx

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -88,30 +88,6 @@ const ChartCard = ({
8888
/>
8989
)
9090

91-
const renderCardInfo = () => (
92-
<div className="flexbox-col flex-grow-1 dc__gap-8">
93-
<div className="flexbox-col dc__gap-2">
94-
<div className="flex left">
95-
<InteractiveCellText
96-
text={chart.name}
97-
rootClassName="fw-6 chart-grid-item__title cn-9"
98-
fontSize={14}
99-
/>
100-
<div className="chart-name__arrow dc__no-shrink flex">
101-
<Icon name="ic-caret-down-small" color="B500" rotateBy={270} />
102-
</div>
103-
</div>
104-
{chart.deprecated && renderDeprecatedWarning()}
105-
</div>
106-
107-
<span
108-
className={`fw-4 fs-13 lh-1-5 ${getDescriptionTruncate({ isListView, isDeprecated: chart.deprecated })}`}
109-
>
110-
{chart.description || 'No description'}
111-
</span>
112-
</div>
113-
)
114-
11591
const renderFooter = () => (
11692
<div className="flex left dc__content-space dc__border-top-n1 px-20 py-16 dc__gap-6">
11793
<div className="flex dc__gap-6">
@@ -155,7 +131,27 @@ const ChartCard = ({
155131
{renderAddIcon()}
156132
</div>
157133
)}
158-
{renderCardInfo()}
134+
<div className="flexbox-col flex-grow-1 dc__gap-8">
135+
<div className="flexbox-col dc__gap-2">
136+
<div className="flex left">
137+
<InteractiveCellText
138+
text={chart.name}
139+
rootClassName="fw-6 chart-grid-item__title cn-9"
140+
fontSize={14}
141+
/>
142+
<div className="chart-name__arrow dc__no-shrink flex">
143+
<Icon name="ic-caret-down-small" color="B500" rotateBy={270} />
144+
</div>
145+
</div>
146+
{chart.deprecated && renderDeprecatedWarning()}
147+
</div>
148+
149+
<span
150+
className={`fw-4 fs-13 lh-1-5 ${getDescriptionTruncate({ isListView, isDeprecated: chart.deprecated })}`}
151+
>
152+
{chart.description || 'No description'}
153+
</span>
154+
</div>
159155
</div>
160156
{renderFooter()}
161157
</div>

src/components/charts/charts.util.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ export const renderDeprecatedWarning = () => {
5050
}
5151

5252
export const getChartGroupSubgroup = (chartGroupEntries): ChartGroupEntry[] => {
53-
let len = chartGroupEntries.length
54-
len = len < CHART_CARD_MAX_LENGTH ? len : CHART_CARD_MAX_LENGTH
53+
const len = Math.min(chartGroupEntries.length, CHART_CARD_MAX_LENGTH)
5554
return chartGroupEntries.slice(0, len)
5655
}
5756

0 commit comments

Comments
 (0)