diff --git a/client/main.js b/client/main.js index a002603..7261bd7 100644 --- a/client/main.js +++ b/client/main.js @@ -1,3 +1,3 @@ -import '../imports/startup/client';/* -import '../node_modules/daemonite-material/js/material.min.js'; -import '../node_modules/daemonite-material/css/material.css';*/ +import '../imports/startup/client'; +/* import '../node_modules/daemonite-material/js/material.min.js'; + * import '../node_modules/daemonite-material/css/material.css';*/ diff --git a/imports/ui/components/AuthenticatedNavigation/AuthenticatedNavigation.js b/imports/ui/components/AuthenticatedNavigation/AuthenticatedNavigation.js index ea487c8..82b78b9 100644 --- a/imports/ui/components/AuthenticatedNavigation/AuthenticatedNavigation.js +++ b/imports/ui/components/AuthenticatedNavigation/AuthenticatedNavigation.js @@ -2,22 +2,35 @@ import React from 'react'; import PropTypes from 'prop-types'; import { withRouter } from 'react-router-dom'; import { LinkContainer } from 'react-router-bootstrap'; -import { Nav, NavItem, NavDropdown, MenuItem } from 'react-bootstrap'; +import { Nav, NavDropdown, MenuItem } from 'react-bootstrap'; +/* + FIXME: + navitem needs a nav-link class but does not works + https://github.com/react-bootstrap/react-bootstrap/issues/2644 + className="nav-link" + so we did a custom NavLink + */ +import NavItem from '../NavItem/NavItem'; import { Meteor } from 'meteor/meteor'; const AuthenticatedNavigation = ({ name, history }) => (
{/* - https://github.com/react-bootstrap/react-bootstrap/blob/master/src/Nav.js + https://github.com/react-bootstrap/react-bootstrap/blob/master/src/Nav.js */} */} -
- Profile - history.push('/logout')} >Logout -
+ +
); diff --git a/imports/ui/components/NavItem/NavItem.js b/imports/ui/components/NavItem/NavItem.js new file mode 100644 index 0000000..953cf85 --- /dev/null +++ b/imports/ui/components/NavItem/NavItem.js @@ -0,0 +1,79 @@ +import classNames from 'classnames'; +import React from 'react'; +import PropTypes from 'prop-types'; + +import { SafeAnchor } from 'react-bootstrap'; +import createChainedFunction from 'react-bootstrap/lib/utils/createChainedFunction'; + +const propTypes = { + active: PropTypes.bool, + disabled: PropTypes.bool, + role: PropTypes.string, + href: PropTypes.string, + onClick: PropTypes.func, + onSelect: PropTypes.func, + eventKey: PropTypes.any, +}; + +const defaultProps = { + active: false, + disabled: false, +}; + +class NavItem extends React.Component { + constructor(props, context) { + super(props, context); + + this.handleClick = this.handleClick.bind(this); + } + + handleClick(e) { + if (this.props.onSelect) { + e.preventDefault(); + + if (!this.props.disabled) { + this.props.onSelect(this.props.eventKey, e); + } + } + } + + render() { + const { active, disabled, onClick, className, anchorClassName, style, ...props } = + this.props; + + delete props.onSelect; + delete props.eventKey; + + // These are injected down by `