Skip to content

Commit c4e3ee9

Browse files
committed
refactor: migrate IdAnchor to tw
1 parent be880e3 commit c4e3ee9

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

src/components/Glossary/GlossaryDefinition/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const GlossaryDefinition = ({
3131
return (
3232
<Stack className="mb-8 items-stretch gap-4 text-start">
3333
<h4
34-
className={term ? "relative scroll-mt-28" : ""}
34+
className={term ? "group relative scroll-mt-28" : ""}
3535
{...(term ? { "data-group": true, id: term } : {})}
3636
>
3737
<IdAnchor id={term} />

src/components/IdAnchor.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
import { CiLink } from "react-icons/ci"
22

3-
import Link from "@/components/Link"
3+
import { BaseLink } from "@/components/ui/Link"
44

55
const IdAnchor = ({ id }: { id?: string }) => {
66
if (!id) return null
77
return (
8-
<Link
9-
href={"#" + id}
10-
position="absolute"
11-
insetInlineEnd="100%"
8+
<BaseLink
9+
className="absolute end-full flex h-full items-center opacity-0 transition-opacity duration-100 ease-in-out focus:opacity-100 group-hover:opacity-100"
1210
aria-label={id.replaceAll("-", " ") + " permalink"}
13-
opacity={0}
14-
_groupHover={{ opacity: 1 }}
15-
_focus={{ opacity: 1 }}
16-
transition="opacity 0.1s ease-in-out"
11+
href={"#" + id}
1712
>
1813
<CiLink className="me-1 text-xl" />
19-
</Link>
14+
</BaseLink>
2015
)
2116
}
2217

src/components/MdComponents/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const commonHeadingAttributes = (className: string, id?: string) => ({
3636
id,
3737
className: cn(
3838
"font-bold leading-xs my-8",
39-
id && "scroll-mt-28 relative",
39+
id && "scroll-mt-28 relative group",
4040
className
4141
),
4242
"data-group": !!id || undefined,

0 commit comments

Comments
 (0)