You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
450 B
TypeScript
21 lines
450 B
TypeScript
8 years ago
|
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>;
|
||
|
}
|
||
|
}
|