Skip to content

Commit

Permalink
fix(toc): fix text truncate in title line
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Oct 28, 2024
1 parent f51dfdd commit f9b1a61
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions apps/renderer/src/components/ui/markdown/components/TocItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EllipsisHorizontalTextWithTooltip } from "@follow/components/ui/typography/index.js"
import { cn } from "@follow/utils/utils"
import { clsx, cn } from "@follow/utils/utils"
import type { FC, MouseEvent } from "react"
import { memo, useCallback, useRef } from "react"

Expand Down Expand Up @@ -35,7 +35,7 @@ export const TocItem: FC<TocItemProps> = memo((props) => {
type="button"
ref={$ref}
data-index={index}
className={cn("cursor-pointer", isTitleLine && "relative flex min-w-0 flex-col")}
className={cn("cursor-pointer", isTitleLine && "relative flex w-full flex-col")}
style={
isTitleLine
? {
Expand All @@ -55,7 +55,14 @@ export const TocItem: FC<TocItemProps> = memo((props) => {
title={title}
>
{isTitleLine && (
<EllipsisHorizontalTextWithTooltip className="w-full min-w-0 truncate text-left text-xs text-zinc-500 hover:!text-zinc-500 dark:text-zinc-400 dark:hover:!text-zinc-300">
<EllipsisHorizontalTextWithTooltip
className={clsx(
"w-full min-w-0 truncate text-left text-xs",
range
? "text-zinc-900 dark:text-zinc-300"
: "text-zinc-500 hover:text-zinc-500 dark:text-zinc-400 dark:hover:text-zinc-300",
)}
>
{title}
</EllipsisHorizontalTextWithTooltip>
)}
Expand Down

0 comments on commit f9b1a61

Please sign in to comment.