FastGPT/projects/app/src/components/Markdown/codeBlock/StructureRender/Link.tsx
Finley Ge 8a68e9c208
perf: move structured render components (#5710)
* perf: move structured render components

* chore: remove useless code
2025-09-26 10:21:30 +08:00

32 lines
707 B
TypeScript

import React from 'react';
import { Box, Text, Link, Flex } from '@chakra-ui/react';
const LinkBlock: React.FC<{ data: { text: string; url: string } }> = ({ data }) => {
const handleClick = () => {
window.open(data.url, '_blank', 'noopener,noreferrer');
};
return (
<Box my={4}>
<Link
onClick={handleClick}
cursor="pointer"
textDecoration="none"
_hover={{ textDecoration: 'none' }}
>
<Text
fontWeight="medium"
color="blue.600"
_hover={{ color: 'blue.700' }}
noOfLines={1}
flex="1"
>
{data.text}
</Text>
</Link>
</Box>
);
};
export default LinkBlock;