Skip to content

Commit fe3f1eb

Browse files
Update TOCInline.tsx
Enhances functionality by providing users with the option to customize the styling of list (li) elements. I'm currently utilizing this library and felt the need to personalize the appearance of my li elements. Therefore, I'm suggesting this modification to the library to ensure that everyone can take advantage of this improvement.
1 parent 10f766e commit fe3f1eb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/pliny/src/ui/TOCInline.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface TOCInlineProps {
88
exclude?: string | string[]
99
collapse?: boolean
1010
ulClassName?: string
11+
liClassName?: string
1112
}
1213

1314
export interface NestedTocItem extends TocItem {
@@ -57,6 +58,7 @@ const createNestedList = (items: TocItem[]): NestedTocItem[] => {
5758
* exclude = '',
5859
* collapse = false,
5960
* ulClassName = '',
61+
* liClassName = '',
6062
* }
6163
*
6264
*/
@@ -68,6 +70,7 @@ const TOCInline = ({
6870
exclude = '',
6971
collapse = false,
7072
ulClassName = '',
73+
liClassName = '',
7174
}: TOCInlineProps) => {
7275
const re = Array.isArray(exclude)
7376
? new RegExp('^(' + exclude.join('|') + ')$', 'i')
@@ -86,7 +89,7 @@ const TOCInline = ({
8689
return (
8790
<ul className={ulClassName}>
8891
{items.map((item, index) => (
89-
<li key={index}>
92+
<li key={index} className={liClassName}>
9093
<a href={item.url}>{item.value}</a>
9194
{createList(item.children)}
9295
</li>

0 commit comments

Comments
 (0)