ant-design/components/anchor/AnchorLink.tsx

20 lines
486 B
TypeScript
Raw Normal View History

2016-10-28 14:02:55 +08:00
import React from 'react';
2016-10-28 16:53:59 +08:00
import classnames from 'classnames';
2016-10-28 14:02:55 +08:00
export interface AnchorLinkProps {
href: string;
onClick: (href: string) => {};
active: boolean;
}
2016-10-28 16:53:59 +08:00
export default function AnchorLink(props) {
const { prefixCls, active, href, children, onClick } = props;
const cls = classnames({
[`${prefixCls}-link`]: true,
[`${prefixCls}-link-active`]: active,
});
return <div className={cls} onClick={() => onClick(props.href)} >
{children}
2016-10-28 14:02:55 +08:00
</div>;
}