Skip to content

Commit

Permalink
Update TOCInline.tsx
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Abhinavpatel00 authored Feb 18, 2024
1 parent 10f766e commit fe3f1eb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/pliny/src/ui/TOCInline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface TOCInlineProps {
exclude?: string | string[]
collapse?: boolean
ulClassName?: string
liClassName?: string
}

export interface NestedTocItem extends TocItem {
Expand Down Expand Up @@ -57,6 +58,7 @@ const createNestedList = (items: TocItem[]): NestedTocItem[] => {
* exclude = '',
* collapse = false,
* ulClassName = '',
* liClassName = '',
* }
*
*/
Expand All @@ -68,6 +70,7 @@ const TOCInline = ({
exclude = '',
collapse = false,
ulClassName = '',
liClassName = '',
}: TOCInlineProps) => {
const re = Array.isArray(exclude)
? new RegExp('^(' + exclude.join('|') + ')$', 'i')
Expand All @@ -86,7 +89,7 @@ const TOCInline = ({
return (
<ul className={ulClassName}>
{items.map((item, index) => (
<li key={index}>
<li key={index} className={liClassName}>
<a href={item.url}>{item.value}</a>
{createList(item.children)}
</li>
Expand Down

0 comments on commit fe3f1eb

Please sign in to comment.