Skip to content

Commit 05fdadb

Browse files
committed
fix: some ui
1 parent 108b2cc commit 05fdadb

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/components/layout/header/internal/HeaderDrawerButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const HeaderDrawerButton = () => {
3636

3737
<Dialog.Content>
3838
<m.dialog
39-
className="fixed left-0 right-0 top-0 z-[12] block overflow-auto rounded-xl bg-base-100/90 backdrop-blur-sm"
39+
className="fixed left-0 right-0 top-0 z-[12] m-0 block w-full overflow-auto rounded-xl bg-base-100/90 px-3 backdrop-blur-sm"
4040
initial={{ opacity: 0.8 }}
4141
animate={{ opacity: 1 }}
4242
exit={{ opacity: 0 }}

src/components/widgets/comment/Comment.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export const Comment: Component<{
119119
{key}
120120
</span>
121121
{!!location && (
122-
<span className="min-w-0 max-w-full flex-shrink-0 break-all text-[10px] opacity-[0.35]">
122+
<span className="min-w-0 max-w-full truncate break-all text-[10px] opacity-[0.35]">
123123
来自:{location}
124124
</span>
125125
)}

src/components/widgets/toc/TocFAB.tsx

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { useCallback } from 'react'
3+
import { useCallback, useMemo } from 'react'
44
import { useParams, usePathname } from 'next/navigation'
55

66
import { FABPortable } from '~/components/ui/fab'
@@ -14,18 +14,23 @@ export const TocFAB = () => {
1414
const pathname = usePathname()
1515
const params = useParams()
1616

17-
const presentToc = useCallback(() => {
17+
const $headings = useMemo(() => {
1818
const $mainMarkdownRender = document.getElementById(MAIN_MARKDOWN_ID)
1919
if (!$mainMarkdownRender) return
20+
2021
const $headings = [
2122
...$mainMarkdownRender.querySelectorAll('h1,h2,h3,h4,h5,h6'),
2223
] as HTMLHeadingElement[]
24+
25+
return $headings
26+
}, [])
27+
const presentToc = useCallback(() => {
2328
const dispose = present({
2429
title: 'Table of Content',
2530

2631
content: () => (
2732
<TocTree
28-
$headings={$headings}
33+
$headings={$headings!}
2934
className="space-y-3 [&>li]:py-1"
3035
onItemClick={() => {
3136
dispose()
@@ -34,7 +39,10 @@ export const TocFAB = () => {
3439
/>
3540
),
3641
})
37-
}, [pathname, params])
42+
}, [pathname, params, $headings])
43+
44+
if (!$headings?.length) return null
45+
3846
return (
3947
<FABPortable aria-label="Show ToC" onClick={presentToc}>
4048
<i className="icon-[mingcute--list-expansion-line]" />

0 commit comments

Comments
 (0)