diff --git a/src/Collapse.js b/src/Collapse.js index 56a622bba5..fa4a420ec5 100644 --- a/src/Collapse.js +++ b/src/Collapse.js @@ -1,5 +1,6 @@ import css from 'dom-helpers/style'; import React from 'react'; +import classNames from 'classnames'; import Transition from 'react-overlays/lib/Transition'; import deprecated from 'react-prop-types/lib/deprecated'; @@ -50,7 +51,7 @@ class Collapse extends React.Component { ref="transition" {...this.props} aria-expanded={this.props.role ? this.props.in : null} - className={this._dimension() === 'width' ? 'width' : ''} + className={classNames(this.props.className, { width: this._dimension() === 'width' })} exitedClassName="collapse" exitingClassName="collapsing" enteredClassName="collapse in" diff --git a/src/Fade.js b/src/Fade.js index 934dfeca00..971be2a5ee 100644 --- a/src/Fade.js +++ b/src/Fade.js @@ -1,4 +1,5 @@ import React from 'react'; +import classNames from 'classnames'; import Transition from 'react-overlays/lib/Transition'; import deprecated from 'react-prop-types/lib/deprecated'; @@ -10,7 +11,7 @@ class Fade extends React.Component { diff --git a/src/Nav.js b/src/Nav.js index 2af6305452..7056e6a98d 100644 --- a/src/Nav.js +++ b/src/Nav.js @@ -2,6 +2,7 @@ import React, { cloneElement } from 'react'; import classNames from 'classnames'; import Collapse from './Collapse'; import all from 'react-prop-types/lib/all'; +import deprecated from 'react-prop-types/lib/deprecated'; import tbsUtils, { bsStyles, bsClass } from './utils/bootstrapUtils'; import ValidComponentChildren from './utils/ValidComponentChildren'; import createChainedFunction from './utils/createChainedFunction'; @@ -9,41 +10,45 @@ import createChainedFunction from './utils/createChainedFunction'; class Nav extends React.Component { render() { - const classes = this.props.collapsible ? 'navbar-collapse' : null; - - if (this.props.navbar && !this.props.collapsible) { - return (this.renderUl()); - } - - return ( - - - - ); - } - - renderUl() { + const { className, ulClassName, id, ulId } = this.props; const classes = tbsUtils.getClassSet(this.props); - // TODO: need to pass navbar bsClass down... classes[tbsUtils.prefix(this.props, 'stacked')] = this.props.stacked; classes[tbsUtils.prefix(this.props, 'justified')] = this.props.justified; - classes['navbar-nav'] = this.props.navbar; - classes['pull-right'] = this.props.pullRight; - classes['navbar-right'] = this.props.right; - return ( - ); + + if (this.props.collapsible) { + list = ( + +
+ { list } +
+
+ ); + } + + return list; } getChildActiveProp(child) { @@ -107,12 +112,19 @@ Nav.propTypes = { ]), /** * CSS classes for the inner `ul` element + * + * @deprecated */ - ulClassName: React.PropTypes.string, + ulClassName: deprecated(React.PropTypes.string, + 'The wrapping `