mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 11:39:28 +08:00
21 lines
450 B
TypeScript
21 lines
450 B
TypeScript
|
import React from 'react';
|
||
|
|
||
|
|
||
|
export interface AnchorLinkProps {
|
||
|
href: string;
|
||
|
onClick: (href: string) => {};
|
||
|
active: boolean;
|
||
|
}
|
||
|
|
||
|
export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
|
||
|
onClick = () => {
|
||
|
if (this.props.href) {
|
||
|
this.props.onClick(this.props.href);
|
||
|
}
|
||
|
}
|
||
|
render() {
|
||
|
return <div onClick={this.onClick}>
|
||
|
{this.props.active ? 'active':null } {this.props.children}
|
||
|
</div>;
|
||
|
}
|
||
|
}
|