tachybase_todo/.dumi/theme/components/SlugList.tsx
chenos d5d0e1036b
docs: add docs (#75)
* docs: add docs

* ignore dumi theme test

* fix: error TS2717: Subsequent property declarations must have the same type.

* update docs

* deploy gh-pages

* plugins docs

* hash & cname

* exportStatic

* ssr

* vercel

* vercel

* fix: deploy vercel

* Delete vercel.json

* docs

* fix APP_DIST

* on master branch
2021-04-17 21:33:21 +08:00

21 lines
579 B
TypeScript
Executable File

import type { FC } from 'react';
import React from 'react';
import { AnchorLink } from 'dumi/theme';
import './SlugList.less';
const SlugsList: FC<{ slugs: any; className?: string }> = ({ slugs, ...props }) => (
<ul role="slug-list" {...props}>
{slugs
.filter(({ depth }) => depth > 1 && depth < 5)
.map(slug => (
<li key={slug.heading} title={slug.value} data-depth={slug.depth}>
<AnchorLink to={`#${slug.heading}`}>
<span>{slug.value}</span>
</AnchorLink>
</li>
))}
</ul>
);
export default SlugsList;