FastGPT/document/components/docs/linkFastGPT.tsx
Archer 393b7abe7d
Some checks are pending
Document deploy / build-images (map[domain:https://fastgpt.cn suffix:cn]) (push) Waiting to run
Document deploy / build-images (map[domain:https://fastgpt.io suffix:io]) (push) Waiting to run
Document deploy / update-images (map[deployment:fastgpt-docs domain:https://fastgpt.cn kube_config:KUBE_CONFIG_CN suffix:cn]) (push) Blocked by required conditions
Document deploy / update-images (map[deployment:fastgpt-docs domain:https://fastgpt.io kube_config:KUBE_CONFIG_IO suffix:io]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / get-vars (push) Waiting to run
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:amd64 runs-on:ubuntu-24.04]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / release-fastgpt-images (push) Blocked by required conditions
Document action (#5304)
* fix: context

* fix: context

* action

* update scripts

* update action

* fix: kubeconfig

* update preview

* docker file

* perf: action per

* update doc deploy yml

* doc (#99)

* doc

* doc

* rename

* doc

* fix: action on

* doc (#100)
2025-07-23 23:27:37 +08:00

59 lines
1.3 KiB
TypeScript

'use client';
import React, { useMemo } from 'react';
type FastGPTLinkProps = {
children: React.ReactNode;
className?: string;
style?: React.CSSProperties;
onClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;
};
const defaultStyles: React.CSSProperties = {
color: '#3370ff',
textDecoration: 'none',
transition: 'all 0.2s ease-in-out'
};
const hoverStyles: React.CSSProperties = {
color: '#2152d9',
textDecoration: 'underline'
};
const FastGPTLink = ({ children, className, style, onClick, ...props }: FastGPTLinkProps) => {
const href = useMemo(() => {
return process.env.NEXT_PUBLIC_HOME_DOMAIN ?? 'https://fastgpt.io';
}, []);
const [isHovered, setIsHovered] = React.useState(false);
const combinedStyles = {
...defaultStyles,
...(isHovered ? hoverStyles : {}),
...style
};
return (
<a
href={href}
target="_blank"
rel="noopener noreferrer"
className={className}
style={combinedStyles}
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
onClick={(e) => {
if (onClick) {
e.preventDefault();
onClick(e);
}
}}
{...props}
>
{children}
</a>
);
};
export default React.memo(FastGPTLink);