Skip to content

Commit a980fc5

Browse files
committed
feat: add selectors on doc menu for docsearch
1 parent 50dd97e commit a980fc5

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

pwa/components/docs/DocMenu.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function NavPart({ title, link, links, basePath, autoOpen }: NavPartProps) {
3131
return (
3232
<div
3333
className={classNames(
34-
"transition-all duration-300",
34+
"doc-nav transition-all duration-300",
3535
isOpen ? "mb-8" : "mb-4"
3636
)}
3737
>
@@ -48,15 +48,27 @@ function NavPart({ title, link, links, basePath, autoOpen }: NavPartProps) {
4848
<Link
4949
href={link}
5050
prefetch={false}
51-
className="flex-1 font-semibold uppercase"
51+
className={classNames(
52+
"flex-1 font-semibold uppercase doc-category",
53+
pathname === link ||
54+
(pathname.startsWith(basePath) &&
55+
basePath !== "" &&
56+
"is-active") // for docsearch
57+
)}
5258
>
5359
{title}
5460
</Link>
5561
) : (
5662
<p
5763
role="button"
5864
onClick={() => setOpen(!isOpen)}
59-
className="flex-1 font-semibold uppercase"
65+
className={classNames(
66+
"flex-1 font-semibold uppercase doc-category",
67+
pathname === link ||
68+
(pathname.startsWith(basePath) &&
69+
basePath !== "" &&
70+
"is-active") // for docsearch
71+
)}
6072
>
6173
{title}
6274
</p>

0 commit comments

Comments
 (0)