Skip to content

Commit 7096e8f

Browse files
Leshe4kaLeshe4ka
andauthored
Topic cell as link (#1483)
Co-authored-by: Leshe4ka <kozyurov.alexey@google.com>
1 parent 550bd05 commit 7096e8f

File tree

1 file changed

+9
-23
lines changed
  • frontend/src/components/Connect/List/ConnectorsTable/connectorsColumns/cells

1 file changed

+9
-23
lines changed

frontend/src/components/Connect/List/ConnectorsTable/connectorsColumns/cells/TopicsCell.tsx

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import { FullConnectorInfo } from 'generated-sources';
33
import { CellContext } from '@tanstack/react-table';
4-
import { useNavigate } from 'react-router-dom';
54
import { MultiLineTag } from 'components/common/Tag/Tag.styled';
65
import { ClusterNameRoute, clusterTopicPath } from 'lib/paths';
76
import useAppParams from 'lib/hooks/useAppParams';
@@ -13,31 +12,18 @@ const TopicsCell: React.FC<CellContext<FullConnectorInfo, unknown>> = ({
1312
}) => {
1413
const { topics } = row.original;
1514
const { clusterName } = useAppParams<ClusterNameRoute>();
16-
const navigate = useNavigate();
17-
18-
const navigateToTopic = (
19-
e: React.KeyboardEvent | React.MouseEvent,
20-
topic: string
21-
) => {
22-
e.preventDefault();
23-
e.stopPropagation();
24-
navigate(clusterTopicPath(clusterName, topic));
25-
};
2615

2716
return (
2817
<S.TagsWrapper>
29-
{topics?.map((t) => (
30-
<MultiLineTag key={t} color="green">
31-
<span
32-
role="link"
33-
onClick={(e) => navigateToTopic(e, t)}
34-
onKeyDown={(e) => navigateToTopic(e, t)}
35-
tabIndex={0}
36-
>
37-
{t}
38-
</span>
39-
</MultiLineTag>
40-
))}
18+
{topics?.map((t) => {
19+
const href = clusterTopicPath(clusterName, t);
20+
21+
return (
22+
<MultiLineTag key={t} color="green">
23+
<a href={href}>{t}</a>
24+
</MultiLineTag>
25+
);
26+
})}
4127
</S.TagsWrapper>
4228
);
4329
};

0 commit comments

Comments
 (0)