You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're starting to use the TableOfContents component in more places than just Docs, so it makes sense for us to make it a bit more generic and move it to @stoplight/ui-kit. BUT we should keeps the parts of the TableOfContents components that deal with Project nodes in this repo (see below).
Tasks
Move the ITableOfContents interface to ui-kit and remove the items prop:
export interface ITableOfContents {
- // List of items that will be computed into the tree structure- items?: IProjectNode[];
contents: IContentsNode[];
// Padding that will be used for (default: 10)
padding?: string;
className?: string;
// Title of project
title?: string;
// Controls for the drawer functionality on mobile
isOpen?: boolean;
onClose?: () => void;
// Mobile breakpoint, default (true) is 786px, false disables Drawer
enableDrawer?: boolean | number;
}
Chore summary
We're starting to use the TableOfContents component in more places than just Docs, so it makes sense for us to make it a bit more generic and move it to
@stoplight/ui-kit
. BUT we should keeps the parts of the TableOfContents components that deal with Project nodes in this repo (see below).Tasks
items
prop:https://github.com/stoplightio/elements/blob/master/src/components/TableOfContents.tsx
IContentsNode
, replace thesrn
prop withisActive
and add an optionalhref
prop:useComputeToc
to take "srn" as an optional second argument: https://github.com/stoplightio/elements/blob/master/src/hooks/useComputeToc.tsx#L12useComputeToc
to add theisActive
boolean to the node with the matchingsrn
Here's an example: https://github.com/stoplightio/elements/blob/master/src/hooks/useComputeToc.tsx#L68-L71
Example: (note the addition of "href" and the "isActive" prop to the last Github)
Result:
The text was updated successfully, but these errors were encountered: