Skip to content

Commit 7fd9475

Browse files
committed
feat: refactor code
1 parent 6aa5508 commit 7fd9475

34 files changed

+1957
-1665
lines changed

public/locales/en.json

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,12 @@
357357
"unhealthy": "Unhealthy",
358358
"progress": "Managed",
359359
"remaining": "Remaining",
360-
"active": "Active"
360+
"active": "Active",
361+
"inactive": "Inactive",
362+
"providers": "Provider",
363+
"health": "Health",
364+
"serviceaccounts": "ServiceAccounts",
365+
"loading": "Loading..."
361366
},
362367
"errors": {
363368
"installError": "Install error",
@@ -399,13 +404,7 @@
399404
"noResources": "No Resources",
400405
"inactive": "Inactive",
401406
"activate": "Activate",
402-
"healthy": "Healthy",
403-
"hoverContent": {
404-
"totalResources": "Total Resources",
405-
"healthy": "Healthy",
406-
"creating": "Creating",
407-
"failing": "Failing"
408-
}
407+
"healthy": "Healthy"
409408
},
410409
"GitOpsHint": {
411410
"title": "Flux",
@@ -415,12 +414,7 @@
415414
"noResources": "No Resources",
416415
"inactive": "Inactive",
417416
"activate": "Activate",
418-
"managed": "Managed",
419-
"hoverContent": {
420-
"totalResources": "Total Resources",
421-
"managed": "Managed",
422-
"unmanaged": "Unmanaged"
423-
}
417+
"managed": "Persisted"
424418
},
425419
"MembersHint": {
426420
"title": "Members",
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
.container {
2+
position: relative;
3+
width: 100%;
4+
height: 100%;
5+
display: flex;
6+
flex-direction: column;
7+
}
8+
9+
.card {
10+
height: 100%;
11+
display: flex;
12+
flex-direction: column;
13+
}
14+
15+
.disabled {
16+
opacity: 0.6;
17+
user-select: none;
18+
pointer-events: none;
19+
}
20+
21+
.clickable {
22+
cursor: pointer;
23+
}
24+
25+
.disabledOverlay {
26+
position: absolute;
27+
top: 0;
28+
left: 0;
29+
right: 0;
30+
bottom: 0;
31+
background: rgba(0, 0, 0, 0.1);
32+
z-index: 1;
33+
pointer-events: none;
34+
}
35+
36+
.avatar {
37+
width: 50px;
38+
height: 50px;
39+
border-radius: 50%;
40+
background: transparent;
41+
object-fit: cover;
42+
}
43+
44+
.expandButton {
45+
position: absolute;
46+
bottom: 8px;
47+
right: 8px;
48+
min-width: 32px;
49+
height: 32px;
50+
z-index: 10;
51+
}
52+
53+
.expandButtonSmall {
54+
position: absolute;
55+
bottom: 8px;
56+
right: 8px;
57+
min-width: 24px;
58+
height: 24px;
59+
z-index: 10;
60+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { Card, CardHeader, Button } from '@ui5/webcomponents-react';
2+
import { useTranslation } from 'react-i18next';
3+
import cx from 'clsx';
4+
import { ReactNode } from 'react';
5+
import styles from './BaseCard.module.css';
6+
7+
interface BaseCardProps {
8+
title: string;
9+
subtitle?: string;
10+
iconSrc: string;
11+
iconAlt: string;
12+
iconStyle?: React.CSSProperties;
13+
version?: string;
14+
enabled: boolean;
15+
onClick?: () => void;
16+
expanded?: boolean;
17+
size?: 'small' | 'medium' | 'large' | 'extra-large';
18+
children: ReactNode;
19+
}
20+
21+
export const BaseCard = ({
22+
title,
23+
subtitle,
24+
iconSrc,
25+
iconAlt,
26+
iconStyle,
27+
version,
28+
enabled,
29+
onClick,
30+
expanded = false,
31+
size = 'medium',
32+
children,
33+
}: BaseCardProps) => {
34+
const { t } = useTranslation();
35+
36+
return (
37+
<div className={styles.container}>
38+
<Card
39+
header={
40+
<CardHeader
41+
additionalText={enabled && version ? `v${version}` : undefined}
42+
avatar={
43+
<img
44+
src={iconSrc}
45+
alt={iconAlt}
46+
className={styles.avatar}
47+
style={{
48+
...iconStyle,
49+
}}
50+
/>
51+
}
52+
titleText={title}
53+
subtitleText={size === 'small' ? undefined : subtitle}
54+
interactive={enabled}
55+
/>
56+
}
57+
className={cx(styles.card, {
58+
[styles.disabled]: !enabled,
59+
[styles.clickable]: !!onClick && enabled,
60+
})}
61+
onClick={enabled ? onClick : undefined}
62+
>
63+
{!enabled && <div className={styles.disabledOverlay} />}
64+
65+
{onClick && enabled && (
66+
<Button
67+
icon={expanded ? 'sap-icon://collapse' : 'sap-icon://expand'}
68+
design="Transparent"
69+
tooltip={expanded ? t('common.collapse') : t('common.expand')}
70+
style={{ zIndex: 1 }}
71+
className={size === 'small' ? styles.expandButtonSmall : styles.expandButton}
72+
onClick={(e) => {
73+
e.stopPropagation();
74+
onClick();
75+
}}
76+
/>
77+
)}
78+
79+
{children}
80+
</Card>
81+
</div>
82+
);
83+
};

src/components/BentoGrid/ComponentCard/ComponentCard.module.css

Lines changed: 0 additions & 131 deletions
This file was deleted.

0 commit comments

Comments
 (0)