-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* simply logic to generate the breadcrumb items which fixed an issue …
…if there is another file with the same name in the directory structure ( found it while testing some nesting docs ) * updated the docs page styling and hide sidebar if there are no headings available * added `showToc` prop to the frontmatter to force hide the right sidebar in the docs page * moved datatable components to `components/data-table` * added h1-h6 to `mdx-components` to support a quick link for each heading * updated the sidebar width from `w-64` to `w-72`
- Loading branch information
Showing
11 changed files
with
156 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { ElementType, ReactNode } from "react" | ||
|
||
type IntrinsicElement = keyof JSX.IntrinsicElements | ||
type PolymorphicComponentProps<T extends IntrinsicElement> = { | ||
as?: T | ||
} & JSX.IntrinsicElements[T] | ||
|
||
const PolymorphicComponent = <T extends IntrinsicElement>({ | ||
as: elementType = "div" as T, | ||
...rest | ||
}: PolymorphicComponentProps<T>) => { | ||
const Component = elementType as ElementType | ||
return <Component {...rest} /> | ||
} | ||
|
||
export function Heading({ | ||
level, | ||
id, | ||
children, | ||
}: { | ||
level: number | ||
id: string | ||
children: ReactNode | ||
}) { | ||
return ( | ||
<PolymorphicComponent as={`h${level}`} id={id} className="group"> | ||
{children}{" "} | ||
<a | ||
href={`#${id}`} | ||
className="hidden no-underline group-hover:inline-block" | ||
> | ||
# | ||
</a> | ||
</PolymorphicComponent> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.