Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature bootstrap3 #646

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"babel-runtime": "6.6.1",
"bluebird": "3.3.5",
"body-parser": "1.15.0",
"bootstrap": "^3.3.6",
"classnames": "2.2.3",
"cookie-parser": "1.4.1",
"core-js": "2.2.2",
Expand All @@ -32,6 +33,7 @@
"passport-facebook": "2.1.0",
"pretty-error": "2.0.0",
"react": "15.0.1",
"react-bootstrap": "^0.29.3",
"react-dom": "15.0.1",
"sequelize": "^3.21.0",
"source-map-support": "0.4.0",
Expand Down
39 changes: 25 additions & 14 deletions src/components/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,34 @@ import React from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Header.scss';
import Link from '../Link';
import Navigation from '../Navigation';
import {
Navbar,
Nav,
NavItem,
NavDropdown,
MenuItem,
} from 'react-bootstrap';

function Header() {
return (
<div className={s.root}>
<div className={s.container}>
<Navigation className={s.nav} />
<Link className={s.brand} to="/">
<img src={require('./logo-small.png')} width="38" height="38" alt="React" />
<span className={s.brandTxt}>Your Company</span>
</Link>
<div className={s.banner}>
<h1 className={s.bannerTitle}>React</h1>
<p className={s.bannerDesc}>Complex web apps made easy</p>
</div>
</div>
</div>
<Navbar>
<Navbar.Header>
<Navbar.Brand>
<Link className={s.brand} to="/">Your Company</Link>
</Navbar.Brand>
</Navbar.Header>
<Nav>
<NavItem eventKey={1} href="#">Link</NavItem>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@langpavel how do you get NavItem to act like a Link component? I have spent a bunch of time trying to change the UniversalRouter functionality to react-router just to get this working, but I have a feeling that there is a simpler solution. Thanks for your help!

Copy link
Collaborator Author

@langpavel langpavel Jul 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm not sure now.. Try this, It can work:

  <NavItem componentClass={Link} eventKey={1} href="/link" to="/link">Link</NavItem>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much! That worked perfectly.

Copy link

@james075 james075 Apr 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@langpavel @rkait In my case using this: componentClass does not work, I can click on the navItem but nothing happens.

<Navbar.Collapse>
  <Nav pullRight>
    <NavItem 
      componentClass={Link} 
      href="/manifesto" 
      to="/manifesto" 
      className={s.link}
    > Manifesto </NavItem>
  </Nav>
</Navbar.Collapse>

It works when I simply use the Link component. Any ideas how to fix it? Thanks for your help!

<NavItem eventKey={2} href="#">Link</NavItem>
<NavDropdown eventKey={3} title="Dropdown" id="basic-nav-dropdown">
<MenuItem eventKey={3.1}>Action</MenuItem>
<MenuItem eventKey={3.2}>Another action</MenuItem>
<MenuItem eventKey={3.3}>Something else here</MenuItem>
<MenuItem divider />
<MenuItem eventKey={3.3}>Separated link</MenuItem>
</NavDropdown>
</Nav>
</Navbar>
);
}

Expand Down
1 change: 1 addition & 0 deletions src/views/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ html(class="no-js", lang="")
meta(name="description", description=description)
meta(name="viewport", content="width=device-width, initial-scale=1")
link(rel="apple-touch-icon", href="apple-touch-icon.png")
link(rel="stylesheet", href="/css/bootstrap.min.css")
style#css!= css
body
#app!= body
Expand Down
2 changes: 2 additions & 0 deletions tools/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ async function copy({ watch } = {}) {
const ncp = Promise.promisify(require('ncp'));

await Promise.all([
ncp('node_modules/bootstrap/dist/css', 'build/public/css'),
ncp('node_modules/bootstrap/dist/fonts', 'build/public/fonts'),
ncp('src/public', 'build/public'),
ncp('src/content', 'build/content'),
]);
Expand Down