Skip to content

Commit 3f089f0

Browse files
committed
fix: linting
1 parent e605b1f commit 3f089f0

File tree

12 files changed

+194
-202
lines changed

12 files changed

+194
-202
lines changed

src/components/BentoGrid/BentoGrid.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,13 @@ export interface BentoGridProps {
1616
className?: string;
1717
}
1818

19-
export const BentoCard: React.FC<BentoCardProps> = ({
20-
size,
21-
children,
22-
className = '',
23-
gridColumn,
24-
gridRow
25-
}) => {
19+
export const BentoCard: React.FC<BentoCardProps> = ({ size, children, className = '', gridColumn, gridRow }) => {
2620
const cardClass = `${styles.bentoCard} ${styles[`card-${size}`]} ${className}`;
27-
21+
2822
const style: React.CSSProperties = {};
2923
if (gridColumn) style.gridColumn = gridColumn;
3024
if (gridRow) style.gridRow = gridRow;
31-
25+
3226
return (
3327
<div className={cardClass} style={style}>
3428
{children}
@@ -37,9 +31,5 @@ export const BentoCard: React.FC<BentoCardProps> = ({
3731
};
3832

3933
export const BentoGrid: React.FC<BentoGridProps> = ({ children, className = '' }) => {
40-
return (
41-
<div className={`${styles.bentoGrid} ${className}`}>
42-
{children}
43-
</div>
44-
);
34+
return <div className={`${styles.bentoGrid} ${className}`}>{children}</div>;
4535
};

src/components/BentoGrid/ComponentCard/ComponentCard.tsx

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import { MultiPercentageBar } from '../MultiPercentageBar/MultiPercentageBar';
66
import styles from './ComponentCard.module.css';
77
import { GenericHintProps } from '../../../types/types';
88

9-
export const ComponentCard: React.FC<GenericHintProps & {
10-
onClick?: () => void;
11-
size?: 'small' | 'medium' | 'large' | 'extra-large';
12-
secondarySegments?: Array<{ percentage: number; color: string; label: string }>;
13-
secondaryLabel?: string;
14-
expanded?: boolean;
15-
}> = ({
9+
export const ComponentCard: React.FC<
10+
GenericHintProps & {
11+
onClick?: () => void;
12+
size?: 'small' | 'medium' | 'large' | 'extra-large';
13+
secondarySegments?: { percentage: number; color: string; label: string }[];
14+
secondaryLabel?: string;
15+
expanded?: boolean;
16+
}
17+
> = ({
1618
enabled = false,
1719
version,
1820
allItems = [],
@@ -23,7 +25,7 @@ export const ComponentCard: React.FC<GenericHintProps & {
2325
size = 'medium',
2426
secondarySegments,
2527
secondaryLabel = 'Secondary Metric',
26-
expanded = false,
28+
expanded = false,
2729
}) => {
2830
const { t } = useTranslation();
2931
const hintState = config.calculateSegments(allItems, isLoading || false, error, enabled, t);
@@ -60,9 +62,9 @@ export const ComponentCard: React.FC<GenericHintProps & {
6062
{/* Expand/Collapse button */}
6163
{onClick && enabled && (
6264
<Button
63-
icon={expanded ? "sap-icon://collapse" : "sap-icon://expand"}
65+
icon={expanded ? 'sap-icon://collapse' : 'sap-icon://expand'}
6466
design="Transparent"
65-
tooltip={expanded ? "Collapse to overview" : "Expand details"}
67+
tooltip={expanded ? 'Collapse to overview' : 'Expand details'}
6668
style={{ zIndex: 1 }}
6769
className={size === 'small' ? styles.expandButtonSmall : styles.expandButton}
6870
onClick={(e) => {
@@ -72,33 +74,31 @@ export const ComponentCard: React.FC<GenericHintProps & {
7274
/>
7375
)}
7476

75-
<div className={
76-
(size === 'large' || size === 'extra-large') ? styles.contentContainerMultiple : styles.contentContainer
77-
}>
78-
<div className={
79-
size === 'small' ? styles.progressBarContainerSmall :
80-
size === 'medium' ? styles.progressBarContainerMedium :
81-
styles.progressBarContainerLarge
82-
}>
77+
<div
78+
className={
79+
size === 'large' || size === 'extra-large' ? styles.contentContainerMultiple : styles.contentContainer
80+
}
81+
>
82+
<div
83+
className={
84+
size === 'small'
85+
? styles.progressBarContainerSmall
86+
: size === 'medium'
87+
? styles.progressBarContainerMedium
88+
: styles.progressBarContainerLarge
89+
}
90+
>
8391
<MultiPercentageBar
8492
segments={hintState.segments}
8593
className={styles.progressBar}
8694
showOnlyNonZero={hintState.showOnlyNonZero ?? true}
8795
isHealthy={hintState.isHealthy}
88-
barWidth={
89-
size === 'small' ? '80%' :
90-
size === 'medium' ? '85%' :
91-
'90%'
92-
}
96+
barWidth={size === 'small' ? '80%' : size === 'medium' ? '85%' : '90%'}
9397
barHeight={size === 'small' ? '8px' : '12px'}
94-
barMaxWidth={
95-
size === 'small' ? '400px' :
96-
size === 'medium' ? '600px' :
97-
'none'
98-
}
98+
barMaxWidth={size === 'small' ? '400px' : size === 'medium' ? '600px' : 'none'}
9999
labelConfig={{
100100
position: 'above',
101-
displayMode: 'primary',
101+
displayMode: 'primary',
102102
showPercentage: hintState.showPercentage,
103103
showCount: hintState.label?.includes('Roles'),
104104
primaryLabelText: hintState.label,
@@ -113,7 +113,7 @@ export const ComponentCard: React.FC<GenericHintProps & {
113113
showSegmentLabels={hintState.label?.includes('Roles')}
114114
minSegmentWidthForLabel={12}
115115
/>
116-
116+
117117
{/* Secondary chart for large and extra-large cards */}
118118
{(size === 'large' || size === 'extra-large') && secondarySegments && (
119119
<MultiPercentageBar

src/components/BentoGrid/ComponentCard/componentConfigs.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
calculateGitOpsSegments,
66
calculateMembersSegments,
77
calculateVaultSegments,
8-
98
} from '../../../utils/componentCardCalculations';
109

1110
export const useCrossplaneHintConfig = (): GenericHintConfig => {

src/components/BentoGrid/GraphCard/GraphCard.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ export interface GraphCardProps {
99
colorBy?: ColorBy;
1010
}
1111

12-
export const GraphCard: React.FC<GraphCardProps> = ({
13-
className = '',
14-
colorBy = 'source'
15-
}) => {
16-
12+
export const GraphCard: React.FC<GraphCardProps> = ({ className = '', colorBy = 'source' }) => {
1713
return (
1814
<div className={`${styles.container} ${className}`}>
1915
<div className={styles.simpleWrapper}>

src/components/BentoGrid/MultiPercentageBar/MultiPercentageBar.spec.tsx

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,8 @@ describe('MultiPercentageBar utilities', () => {
117117

118118
describe('color configuration utilities', () => {
119119
// Helper function to apply color overrides (simulating component logic)
120-
const applyColorOverrides = (
121-
segments: PercentageSegment[],
122-
overrides: Record<string, string>
123-
) => {
124-
return segments.map(segment => ({
120+
const applyColorOverrides = (segments: PercentageSegment[], overrides: Record<string, string>) => {
121+
return segments.map((segment) => ({
125122
...segment,
126123
color: overrides[segment.label] || segment.color,
127124
}));
@@ -134,8 +131,8 @@ describe('MultiPercentageBar utilities', () => {
134131
];
135132

136133
const overrides = {
137-
'Healthy': '#00ff00',
138-
'Unhealthy': '#ff0000',
134+
Healthy: '#00ff00',
135+
Unhealthy: '#ff0000',
139136
};
140137

141138
const result = applyColorOverrides(segments, overrides);
@@ -151,7 +148,7 @@ describe('MultiPercentageBar utilities', () => {
151148
];
152149

153150
const overrides = {
154-
'Different': '#00ff00',
151+
Different: '#00ff00',
155152
};
156153

157154
const result = applyColorOverrides(segments, overrides);
@@ -163,19 +160,12 @@ describe('MultiPercentageBar utilities', () => {
163160

164161
describe('label configuration utilities', () => {
165162
// Helper function to determine if primary label should be hidden
166-
const shouldHidePrimaryLabel = (
167-
segments: PercentageSegment[],
168-
hideWhenSingleFull: boolean
169-
) => {
170-
return hideWhenSingleFull &&
171-
segments.length === 1 &&
172-
segments[0]?.percentage === 100;
163+
const shouldHidePrimaryLabel = (segments: PercentageSegment[], hideWhenSingleFull: boolean) => {
164+
return hideWhenSingleFull && segments.length === 1 && segments[0]?.percentage === 100;
173165
};
174166

175167
it('hides primary label when single segment is 100%', () => {
176-
const segments: PercentageSegment[] = [
177-
{ percentage: 100, color: '#28a745', label: 'Complete' },
178-
];
168+
const segments: PercentageSegment[] = [{ percentage: 100, color: '#28a745', label: 'Complete' }];
179169

180170
expect(shouldHidePrimaryLabel(segments, true)).toBe(true);
181171
expect(shouldHidePrimaryLabel(segments, false)).toBe(false);
@@ -187,9 +177,7 @@ describe('MultiPercentageBar utilities', () => {
187177
{ percentage: 50, color: '#d22020ff', label: 'Unhealthy' },
188178
];
189179

190-
const partialSegment: PercentageSegment[] = [
191-
{ percentage: 80, color: '#28a745', label: 'Partial' },
192-
];
180+
const partialSegment: PercentageSegment[] = [{ percentage: 80, color: '#28a745', label: 'Partial' }];
193181

194182
expect(shouldHidePrimaryLabel(multipleSegments, true)).toBe(false);
195183
expect(shouldHidePrimaryLabel(partialSegment, true)).toBe(false);

0 commit comments

Comments
 (0)