整个Reactstrap Navbar使用示例代码未对齐/反转

时间:2017-10-15 16:09:10

标签: javascript css twitter-bootstrap reactjs reactstrap

我在尝试为我的网站设置Navbar组件时第一次关注reactstrap示例,它看起来与显示的输出完全不同。这是它的样子:

enter image description here

我期待它看起来像(样机):

enter image description here

我到底错在了什么?

这是我的代码:

import React from 'react';
import { Container, Row, Col, Collapse, Navbar, NavbarToggler, NavbarBrand, Nav, NavItem, NavLink } from 'reactstrap';

export default class NavigationBar extends React.Component {
constructor(props) {
  super(props);
  this.toggle = this.toggle.bind(this);
  this.state = {
    isOpen: false
  };
}

toggle() {
  this.setState({
    isOpen: !this.state.isOpen
  });
}

render() {
  return (
    <div className="app">
      <Container fluid={true}>
        <header>
          <Row>
            <Col sm="12" md="12" lg="12">
              <Navbar className="navbar-inverse" toggleable>
                <NavbarToggler right onClick={this.toggle} />
                <NavbarBrand href="/">
                  My App
                </NavbarBrand>
                <Collapse isOpen={this.state.isOpen} navbar>
                  <Nav navbar>
                    <NavItem>
                      <NavLink href="/settings/">Settings</NavLink>
                    </NavItem>
                    <NavItem>
                      <NavLink href="/logout/">Logout</NavLink>
                    </NavItem>
                  </Nav>
                </Collapse>
              </Navbar>
            </Col>
          </Row>
        </header>
      </Container>
        </div>
    );
}
}

html, body {
  height: 100%;
  width: 100%;
}

body {
  padding-top: 0.5rem;
}

0 个答案:

没有答案