@@ -7,6 +7,8 @@ import tbsUtils, { bsStyles, bsClass as _bsClass } from './utils/bootstrapUtils'
77import ValidComponentChildren from './utils/ValidComponentChildren' ;
88import createChainedFunction from './utils/createChainedFunction' ;
99
10+ import Collapse from './Collapse' ;
11+
1012class Nav extends React . Component {
1113
1214 render ( ) {
@@ -17,18 +19,19 @@ class Nav extends React.Component {
1719 classes [ tbsUtils . prefix ( this . props , 'stacked' ) ] = this . props . stacked ;
1820 classes [ tbsUtils . prefix ( this . props , 'justified' ) ] = this . props . justified ;
1921
20-
2122 if ( isNavbar ) {
2223 let bsClass = this . context . $bs_navbar_bsClass || 'navbar' ;
2324 const navbarRight = this . props . right != null ? this . props . right : this . props . pullRight ;
2425
2526 classes [ tbsUtils . prefix ( { bsClass } , 'nav' ) ] = true ;
2627 classes [ tbsUtils . prefix ( { bsClass } , 'right' ) ] = navbarRight ;
28+ classes [ tbsUtils . prefix ( { bsClass } , 'left' ) ] = this . props . pullLeft ;
2729 } else {
2830 classes [ 'pull-right' ] = this . props . pullRight ;
31+ classes [ 'pull-left' ] = this . props . pullLeft ;
2932 }
3033
31- return (
34+ let list = (
3235 < ul ref = "ul"
3336 { ...this . props }
3437 id = { ulId || id }
@@ -38,6 +41,22 @@ class Nav extends React.Component {
3841 { ValidComponentChildren . map ( this . props . children , this . renderNavItem , this ) }
3942 </ ul >
4043 ) ;
44+
45+ // TODO remove in 0.29
46+ if ( this . context . $bs_deprecated_navbar && this . props . collapsible ) {
47+ list = (
48+ < Collapse
49+ in = { this . props . expanded }
50+ className = { isNavbar ? 'navbar-collapse' : void 0 }
51+ >
52+ < div >
53+ { list }
54+ </ div >
55+ </ Collapse >
56+ ) ;
57+ }
58+
59+ return list ;
4160 }
4261
4362 getChildActiveProp ( child ) {
@@ -115,23 +134,41 @@ Nav.propTypes = {
115134 ulId : deprecated ( React . PropTypes . string ,
116135 'The wrapping `<nav>` has been removed you can use `id` now' ) ,
117136
118- expanded : React . PropTypes . bool ,
119-
137+ /**
138+ * Apply styling an alignment for use in a Navbar. This prop will be set
139+ * automatically when the Nav is used inside a Navbar.
140+ */
120141 navbar : React . PropTypes . bool ,
121142 eventKey : React . PropTypes . any ,
122143 pullRight : React . PropTypes . bool ,
123- right : deprecated ( React . PropTypes . bool , 'Use the `pullRight` prop instead' )
144+ pullLeft : React . PropTypes . bool ,
145+
146+ right : deprecated ( React . PropTypes . bool ,
147+ 'Use the `pullRight` prop instead' ) ,
148+
149+ /**
150+ * @private
151+ */
152+ expanded : React . PropTypes . bool ,
153+
154+ /**
155+ * @private
156+ */
157+ collapsible : deprecated ( React . PropTypes . bool ,
158+ 'Use `Navbar.Collapse` instead, to create collapsible Navbars' ) ,
124159} ;
125160
126161Nav . contextTypes = {
127162 $bs_navbar : React . PropTypes . bool ,
128- $bs_navbar_bsClass : React . PropTypes . string
163+ $bs_navbar_bsClass : React . PropTypes . string ,
164+
165+ $bs_deprecated_navbar : React . PropTypes . bool
129166} ;
130167
131168Nav . defaultProps = {
132169 justified : false ,
133170 pullRight : false ,
134- right : false ,
171+ pullLeft : false ,
135172 stacked : false
136173} ;
137174
0 commit comments