fix: add color highlight for entry link, resolves FOL-2288

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei 2025-07-23 21:12:27 +08:00
parent 3a9cec4c64
commit db67ec878e
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
2 changed files with 21 additions and 11 deletions

View File

@ -1,3 +1,4 @@
import { Button } from "@follow/components/ui/button/index.js"
import { MagneticHoverEffect } from "@follow/components/ui/effect/MagneticHoverEffect.js"
import type { LinkProps } from "@follow/components/ui/link/LinkWithTooltip.js"
import {
@ -7,7 +8,7 @@ import {
TooltipTrigger,
} from "@follow/components/ui/tooltip/index.jsx"
import { useCorrectZIndex } from "@follow/components/ui/z-index/ctx.js"
import { stopPropagation } from "@follow/utils"
import { cn, stopPropagation } from "@follow/utils"
import { use, useCallback } from "react"
import { useTranslation } from "react-i18next"
import { toast } from "sonner"
@ -16,7 +17,7 @@ import { copyToClipboard } from "~/lib/clipboard"
import { MarkdownRenderActionContext } from "../context"
export const MarkdownLink = (props: LinkProps) => {
export const MarkdownLink: Component<LinkProps> = (props) => {
const { transformUrl, isAudio, ensureAndRenderTimeStamp } = use(MarkdownRenderActionContext)
const { t } = useTranslation()
@ -51,7 +52,7 @@ export const MarkdownLink = (props: LinkProps) => {
<MagneticHoverEffect
as="a"
draggable="false"
className="text-text font-semibold no-underline"
className={cn("text-text font-semibold no-underline", props.className)}
href={populatedFullHref}
title={props.title}
target="_blank"
@ -68,14 +69,23 @@ export const MarkdownLink = (props: LinkProps) => {
{!!populatedFullHref && (
<TooltipPortal>
<TooltipContent align="start" className="break-all" style={{ zIndex }} side="bottom">
<span>{populatedFullHref}</span>
<button
type="button"
className="text-accent ml-2 cursor-pointer"
onClick={handleCopyLink}
<a
className="follow-link--underline"
href={populatedFullHref}
target="_blank"
rel="noreferrer"
>
{t("share.copy_link")}
</button>
{populatedFullHref}
</a>
<Button
onClick={handleCopyLink}
buttonClassName="p-1 cursor-link"
variant={"ghost"}
aria-label={t("share.copy_link")}
>
<i className="i-mgc-copy-2-cute-re ml-1 size-3" />
</Button>
</TooltipContent>
</TooltipPortal>
)}

View File

@ -35,7 +35,7 @@ export const parseHtml = (
components: {
a: ({ node, ...props }) => {
// markInlineImage(node)
return createElement(MarkdownLink, { ...props } as any)
return createElement(MarkdownLink, { ...props, className: "text-accent" } as any)
},
img: Img,