Skip to content

Commit 8223f37

Browse files
committed
fix
1 parent 8a5fe01 commit 8223f37

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/components/Helper/AnimatedHoverTextButton.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,19 @@ import '@ui5/webcomponents-icons/dist/copy';
33
import { JSX, RefObject, useState } from 'react';
44
import ButtonDesign from '@ui5/webcomponents/dist/types/ButtonDesign.js';
55

6-
export function AnimatedHoverTextButton({
7-
text,
8-
icon,
9-
10-
ref,
11-
}: {
6+
type HoverTextButtonProps = {
127
text: string;
138
icon: JSX.Element;
14-
159
ref?: RefObject<ButtonDomRef | null>;
16-
}) {
10+
onClick: () => void;
11+
};
12+
export const AnimatedHoverTextButton = ({ text, icon, onClick, ref }: HoverTextButtonProps) => {
1713
const [hover, setHover] = useState(false);
1814
return (
1915
<Button
2016
ref={ref}
2117
design={ButtonDesign.Transparent}
18+
onClick={onClick}
2219
onMouseOver={() => setHover(true)}
2320
onMouseLeave={() => setHover(false)}
2421
>
@@ -28,4 +25,4 @@ export function AnimatedHoverTextButton({
2825
</FlexBox>
2926
</Button>
3027
);
31-
}
28+
};

src/components/Shared/ResourceStatusCell.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ButtonDomRef, FlexBox, Icon, ResponsivePopover, Text } from '@ui5/webcomponents-react';
22
import { timeAgo } from '../../utils/i18n/timeAgo';
3-
import { RefObject, useRef, useState } from 'react';
3+
import { useRef, useState } from 'react';
44
import { AnimatedHoverTextButton } from '../Helper/AnimatedHoverTextButton.tsx';
55
import PopoverPlacement from '@ui5/webcomponents/dist/types/PopoverPlacement.js';
66
import styles from './ResourceStatusCell.module.css';
@@ -24,7 +24,9 @@ export const ResourceStatusCell = ({
2424
const handleClose = () => {
2525
setPopoverIsOpen(false);
2626
};
27-
27+
const handleOpen = () => {
28+
setPopoverIsOpen(true);
29+
};
2830
return (
2931
<span>
3032
<AnimatedHoverTextButton
@@ -38,9 +40,10 @@ export const ResourceStatusCell = ({
3840
/>
3941
}
4042
text={isOk ? positiveText : negativeText}
43+
onClick={handleOpen}
4144
/>
4245
<ResponsivePopover
43-
opener={btnRef.current}
46+
opener={btnRef.current ?? undefined}
4447
open={popoverIsOpen}
4548
placement={PopoverPlacement.Bottom}
4649
onClose={handleClose}

0 commit comments

Comments
 (0)