From 22accd7c3d61773bfa3b6651a92e7bc973beeaec Mon Sep 17 00:00:00 2001 From: Kyle Suss Date: Sat, 1 Aug 2020 12:50:26 -0600 Subject: [PATCH] Allow classname in TOC component --- src/components/table-of-contents/TableOfContentsItems.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/table-of-contents/TableOfContentsItems.js b/src/components/table-of-contents/TableOfContentsItems.js index 19c0c44d..001668d6 100644 --- a/src/components/table-of-contents/TableOfContentsItems.js +++ b/src/components/table-of-contents/TableOfContentsItems.js @@ -120,11 +120,11 @@ const List = styled.ul` `} `; -export function TableOfContentsItems({ currentPath, isTopLevel, items, ...rest }) { +export function TableOfContentsItems({ className, currentPath, isTopLevel, items, ...rest }) { const isOrderedList = items.every((item) => item.type === ITEM_TYPES.BULLET_LINK); return ( - + {items.map((item) => { const ItemComponent = getItemComponent(item.type); return ( @@ -142,6 +142,7 @@ export function TableOfContentsItems({ currentPath, isTopLevel, items, ...rest } } TableOfContentsItems.propTypes = { + className: PropTypes.string, currentPath: PropTypes.string.isRequired, isTopLevel: PropTypes.bool.isRequired, items: PropTypes.arrayOf( @@ -150,3 +151,7 @@ TableOfContentsItems.propTypes = { }).isRequired ).isRequired, }; + +TableOfContentsItems.defaultProps = { + className: '', +};