import React, { useContext } from 'react';
import {
Anchor as OldAnchor,
AnchorProps as OldAnchorProps,
ConfigProvider,
AnchorLinkProps as OldAnchorLinkProps,
} from 'antd';
import classNames from 'classnames';
import './index.less';
export interface AnchorProps extends OldAnchorProps {
hideLine?: boolean;
}
export interface AnchorLinkProps extends OldAnchorLinkProps {
links?: OldAnchorLinkProps[];
level?: number;
}
function Anchor(props: AnchorProps) {
// 为了与 antd 的生态保持兼容性,我们要求必须要使用 `.@{ant-prefix}` 变量来生成类名
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const { hideLine = false } = props;
const prefixCls = getPrefixCls('btri-anchor');
return (