Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

Commit

Permalink
feat(Nav): add width props
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimi-Gao committed May 11, 2018
1 parent d579588 commit a7402dd
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/components/Nav/Nav.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
import cx from 'classnames'

class Nav extends Component {
getChildContext () {
Expand All @@ -14,9 +14,14 @@ class Nav extends Component {
}

render () {
const { children, className, href, onItemClick, ...other } = this.props
const { children, className, href, onItemClick, width, ...other } = this.props

if (width) {
other.style = Object.assign(other.style || {}, { width })
}

return (
<div className={classnames('cmui-nav', className)} {...other}>
<div className={cx('cmui-nav', className)} {...other}>
<ul>{children}</ul>
</div>
)
Expand All @@ -33,6 +38,9 @@ Nav.propTypes = {

className: PropTypes.string,

// 宽度,默认`100%`
width: PropTypes.number,

// 所有 NavItem 的基础 href
href: PropTypes.string,

Expand Down

0 comments on commit a7402dd

Please sign in to comment.