Skip to content

Commit b5e3d1f

Browse files
David-DB88workshur
andauthored
[FE] Brokers: fix missing tooltip for config source (#3356)
* . * .. * added getReferenceProps getFloatingProps * testing * testing2 * testing3 * added autoUpdate * added @floating-ui/react * removed @floating-ui/react-dom-interactions --------- Co-authored-by: davitbejanyan <[email protected]> Co-authored-by: Oleg Shur <[email protected]>
1 parent 5983739 commit b5e3d1f

File tree

5 files changed

+33
-26
lines changed

5 files changed

+33
-26
lines changed

kafka-ui-react-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"@babel/core": "^7.16.0",
88
"@babel/plugin-syntax-flow": "^7.18.6",
99
"@babel/plugin-transform-react-jsx": "^7.18.6",
10-
"@floating-ui/react-dom-interactions": "^0.10.3",
10+
"@floating-ui/react": "^0.19.2",
1111
"@hookform/error-message": "^2.0.0",
1212
"@hookform/resolvers": "^2.7.1",
1313
"@microsoft/fetch-event-source": "^2.0.1",

kafka-ui-react-app/pnpm-lock.yaml

Lines changed: 21 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kafka-ui-react-app/src/components/common/ActionComponent/ActionComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Placement } from '@floating-ui/react-dom-interactions';
1+
import { Placement } from '@floating-ui/react';
22
import { Action, ResourceType } from 'generated-sources';
33

44
export interface ActionComponentProps {

kafka-ui-react-app/src/components/common/Tooltip/Tooltip.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
useHover,
55
useInteractions,
66
Placement,
7-
} from '@floating-ui/react-dom-interactions';
7+
} from '@floating-ui/react';
88

99
import * as S from './Tooltip.styled';
1010

@@ -16,26 +16,28 @@ export interface PropsTypes {
1616

1717
const Tooltip: React.FC<PropsTypes> = ({ value, content, placement }) => {
1818
const [open, setOpen] = useState(false);
19-
const { x, y, reference, floating, strategy, context } = useFloating({
19+
const { x, y, refs, strategy, context } = useFloating({
2020
open,
2121
onOpenChange: setOpen,
2222
placement,
2323
});
24-
25-
useInteractions([useHover(context)]);
26-
24+
const hover = useHover(context);
25+
const { getReferenceProps, getFloatingProps } = useInteractions([hover]);
2726
return (
2827
<>
29-
<S.Wrapper ref={reference}>{value}</S.Wrapper>
28+
<div ref={refs.setReference} {...getReferenceProps()}>
29+
<S.Wrapper>{value}</S.Wrapper>
30+
</div>
3031
{open && (
3132
<S.MessageTooltip
32-
ref={floating}
33+
ref={refs.setFloating}
3334
style={{
3435
position: strategy,
3536
top: y ?? 0,
3637
left: x ?? 0,
3738
width: 'max-content',
3839
}}
40+
{...getFloatingProps()}
3941
>
4042
{content}
4143
</S.MessageTooltip>

kafka-ui-react-app/src/lib/hooks/useActionTooltip.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
useFloating,
77
useHover,
88
useInteractions,
9-
} from '@floating-ui/react-dom-interactions';
9+
} from '@floating-ui/react';
1010

1111
export function useActionTooltip(isDisabled?: boolean, placement?: Placement) {
1212
const [open, setOpen] = useState(false);

0 commit comments

Comments
 (0)