Fix NavbarBrand using the correct interface (#20280)

* Fix NavbarBrand using any

* Tests for reactstrap NavbarBrand properties
This commit is contained in:
Fábio Paiva
2017-10-10 00:57:49 +02:00
committed by Wesley Wigham
parent 21badac033
commit faf18110df
2 changed files with 74 additions and 2 deletions

View File

@@ -1,10 +1,10 @@
import { CSSModule } from '../index';
interface NavbarBrand {
interface Props extends React.HTMLProps<HTMLAnchorElement> {
tag?: React.ReactType;
className?: string;
cssModule?: CSSModule;
}
declare var NavbarBrand: React.StatelessComponent<React.HTMLProps<any>>;
declare var NavbarBrand: React.StatelessComponent<Props>;
export default NavbarBrand;

View File

@@ -3412,3 +3412,75 @@ class Example110 extends React.Component<any, any> {
);
}
}
class Example111 extends React.Component<any, any> {
constructor(props: any) {
super(props);
this.toggle = this.toggle.bind(this);
this.state = {
isOpen: false
};
}
toggle() {
this.setState({
isOpen: !this.state.isOpen
});
}
render() {
return (
<div>
<Navbar color="faded" light expand="md">
<NavbarToggler right onClick={this.toggle} />
<NavbarBrand tag="a" href="/">reactstrap</NavbarBrand>
<Collapse isOpen={this.state.isOpen} navbar>
<Nav className="ml-auto" navbar>
<NavItem>
<NavLink href="/components/">Components</NavLink>
</NavItem>
<NavItem>
<NavLink href="https://github.com/reactstrap/reactstrap">Github</NavLink>
</NavItem>
</Nav>
</Collapse>
</Navbar>
</div>
);
}
}
class Example112 extends React.Component<any, any> {
constructor(props: any) {
super(props);
this.toggle = this.toggle.bind(this);
this.state = {
isOpen: false
};
}
toggle() {
this.setState({
isOpen: !this.state.isOpen
});
}
render() {
return (
<div>
<Navbar color="faded" light expand="md">
<NavbarToggler right onClick={this.toggle} />
<NavbarBrand className="logo" href="/">reactstrap</NavbarBrand>
<Collapse isOpen={this.state.isOpen} navbar>
<Nav className="ml-auto" navbar>
<NavItem>
<NavLink href="/components/">Components</NavLink>
</NavItem>
<NavItem>
<NavLink href="https://github.com/reactstrap/reactstrap">Github</NavLink>
</NavItem>
</Nav>
</Collapse>
</Navbar>
</div>
);
}
}