Skip to content

Commit 0f1008c

Browse files
feat: Button behavior + removing dark orange color (#253)
1 parent 252aebe commit 0f1008c

File tree

3 files changed

+42
-11
lines changed

3 files changed

+42
-11
lines changed

src/components/Graphs/CustomNode.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const CustomNode: React.FC<CustomNodeProps> = ({ label, type, status, transition
2828
positiveText={t('common.healthy')}
2929
negativeText={t('errors.notHealthy')}
3030
message={statusMessage}
31+
hideOnHoverEffect={true}
3132
/>
3233
</div>
3334
<div className={styles.nodeTextContainer}>

src/components/Graphs/graphUtils.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,22 @@ export const resolveProviderType = (configName: string, providerConfigsList: Pro
2626
};
2727

2828
export const generateColorMap = (items: NodeData[], colorBy: string): Record<string, string> => {
29-
const colors = ['#E09D00', '#E6600D', '#AB218E', '#678BC7', '#1A9898', '#759421', '#925ACE', '#647987'];
29+
const colors = [
30+
'#FFC933', // MANGO 4
31+
'#FF8AF0', // PINK 4
32+
'#FEADC8', // RASPBERRY 4
33+
'#2CE0BF', // TEAL 4
34+
'#FF8CB2', // RED 4
35+
'#B894FF', // INDIGO 4
36+
'#049F9A', // TEAL 6
37+
'#FA4F96', // RASPBERRY 6
38+
'#F31DED', // PINK 6
39+
'#7858FF', // INDIGO 6
40+
'#07838F', // TEAL 7
41+
'#DF1278', // RASBERRY 7
42+
'#510080', // PINK 10
43+
'#5D36FF', // INDIGO 7
44+
];
3045

3146
const keys = (() => {
3247
if (colorBy === 'source') return Array.from(new Set(items.map((i) => i.providerType).filter(Boolean)));

src/components/Shared/ResourceStatusCell.tsx

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ButtonDomRef, FlexBox, Icon, ResponsivePopover, Text } from '@ui5/webcomponents-react';
1+
import { Button, ButtonDomRef, FlexBox, Icon, ResponsivePopover, Text } from '@ui5/webcomponents-react';
22
import { formatDateAsTimeAgo } from '../../utils/i18n/timeAgo';
33
import { useRef, useState } from 'react';
44
import { AnimatedHoverTextButton } from '../Helper/AnimatedHoverTextButton.tsx';
@@ -10,16 +10,19 @@ export interface ResourceStatusCellProps {
1010
message?: string;
1111
positiveText: string;
1212
negativeText: string;
13+
hideOnHoverEffect?: boolean;
1314
}
1415
export const ResourceStatusCell = ({
1516
isOk,
1617
transitionTime,
1718
message,
1819
positiveText,
1920
negativeText,
21+
hideOnHoverEffect,
2022
}: ResourceStatusCellProps) => {
2123
const btnRef = useRef<ButtonDomRef>(null);
2224
const [popoverIsOpen, setPopoverIsOpen] = useState(false);
25+
const timeAgo = transitionTime ? formatDateAsTimeAgo(transitionTime) : '-';
2326

2427
const handleClose = () => {
2528
setPopoverIsOpen(false);
@@ -29,19 +32,31 @@ export const ResourceStatusCell = ({
2932
};
3033
return (
3134
<span>
32-
<AnimatedHoverTextButton
33-
ref={btnRef}
34-
icon={
35+
{hideOnHoverEffect ? (
36+
<Button ref={btnRef} design="Transparent" title={timeAgo} aria-label={timeAgo} onClick={handleOpen}>
3537
<Icon
3638
design={isOk ? 'Positive' : 'Negative'}
3739
name={isOk ? 'sys-enter-2' : 'sys-cancel-2'}
3840
showTooltip={true}
39-
accessibleName={transitionTime ? formatDateAsTimeAgo(transitionTime) : '-'}
41+
accessibleName={timeAgo}
4042
/>
41-
}
42-
text={isOk ? positiveText : negativeText}
43-
onClick={handleOpen}
44-
/>
43+
</Button>
44+
) : (
45+
<AnimatedHoverTextButton
46+
ref={btnRef}
47+
icon={
48+
<Icon
49+
design={isOk ? 'Positive' : 'Negative'}
50+
name={isOk ? 'sys-enter-2' : 'sys-cancel-2'}
51+
showTooltip={true}
52+
accessibleName={timeAgo}
53+
/>
54+
}
55+
text={isOk ? positiveText : negativeText}
56+
onClick={handleOpen}
57+
/>
58+
)}
59+
4560
<ResponsivePopover
4661
opener={btnRef.current ?? undefined}
4762
open={popoverIsOpen}
@@ -64,7 +79,7 @@ export const ResourceStatusCell = ({
6479
color: isOk ? 'var(--sapPositiveTextColor)' : 'var(--sapNegativeTextColor)',
6580
}}
6681
>
67-
{formatDateAsTimeAgo(transitionTime)}
82+
{timeAgo}
6883
</Text>
6984
</FlexBox>
7085
</ResponsivePopover>

0 commit comments

Comments
 (0)