Skip to content

Commit a6b632d

Browse files
committed
review comments
1 parent e973047 commit a6b632d

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

docs/components/layout/Documentation/Documentation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const Documentation = ({ title = "", description = "", currentPage = undefined,
2727
return <div>
2828
<div>
2929
<div className='flex items-center space-x-4'>
30-
<Heading>{title}</Heading>
30+
<BookMarkLink id={title}> <Heading>{title}</Heading> </BookMarkLink>
3131
</div>
3232
{description && <Text className="mb-4 text-gray-900 font-light">{description}</Text>}
3333
</div>
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
export const BookMarkLink = ({ children, id }) => {
2-
return <div id={id}><a href={`#${id}`}>{children}</a></div>
3-
}
4-
2+
const sanitizedId = id.toLowerCase().replace(/[^a-z0-9-]/g, '-');
3+
return (
4+
<div id={sanitizedId}>
5+
<a
6+
href={`#${sanitizedId}`}
7+
aria-label={`Direct link to ${id}`}
8+
>
9+
{children}
10+
</a>
11+
</div>
12+
);
13+
}

0 commit comments

Comments
 (0)