-
Notifications
You must be signed in to change notification settings - Fork 72
[terra-menu] Dynamic resizing of sub-menu #992
Changes from 6 commits
15d3aee
930cfa5
49827f1
42c0620
b912052
3a25730
fde6e1b
9515f20
a87334b
9cd8f93
445d156
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,10 +59,6 @@ const propTypes = { | |
* Indicates if menu's width has been constrained by bounding container. | ||
*/ | ||
isWidthBounded: PropTypes.bool, | ||
/** | ||
* Fixed height for content. | ||
*/ | ||
fixedHeight: PropTypes.number, | ||
/** | ||
* Fixed width for content. | ||
*/ | ||
|
@@ -297,7 +293,7 @@ class MenuContent extends React.Component { | |
onKeyDown, | ||
isActive, | ||
}); | ||
// If the child has children then it is an item group, so iterate through it's children | ||
// If the child has children then it is an item group, so iterate through it's children | ||
} else if (item.props.children) { | ||
const children = item.props.children ? [] : undefined; | ||
React.Children.forEach(item.props.children, (child) => { | ||
|
@@ -336,7 +332,7 @@ class MenuContent extends React.Component { | |
if (isFullScreen || isSubMenu) { | ||
header = this.buildHeader(isFullScreen); | ||
} | ||
const contentHeight = this.props.isHeightBounded ? '100%' : this.props.fixedHeight; | ||
const contentHeight = this.props.isHeightBounded && '100%'; | ||
const contentPosition = this.props.isHeightBounded ? 'relative' : 'static'; | ||
const contentWidth = this.props.isWidthBounded ? undefined : this.props.fixedWidth; | ||
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, react/forbid-dom-props */ | ||
|
@@ -350,7 +346,7 @@ class MenuContent extends React.Component { | |
role="dialog" | ||
onKeyDown={this.onKeyDown} | ||
> | ||
<ContentContainer header={header} fill={this.props.isHeightBounded || this.props.index > 0}> | ||
<ContentContainer header={header} fill={this.props.isHeightBounded}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was the index prop used here before ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. index > 0 would imply that it is sub-menu that is being rendered. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so how we are handling this scenario now ? after removing this ? |
||
<List className={cx('list')} role="menu"> | ||
{items} | ||
</List> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,18 @@ class SubMenu extends React.Component { | |
className="TestNestedMenu" | ||
subMenuItems={[ | ||
<Menu.Item text="Default 2.1" key="2.1" className="TestNestedMenuContent" />, | ||
<Menu.Item text="Default 2.2" key="2.2" className="TestNestedMenuContent" />, | ||
<Menu.Item text="Default 2.3" key="2.3" className="TestNestedMenuContent" />, | ||
<Menu.Item text="Default 2.4" key="2.4" className="TestNestedMenuContent" />, | ||
<Menu.Item text="Default 2.5" key="2.5" className="TestNestedMenuContent" />, | ||
<Menu.Item text="Default 2.6" key="2.6" className="TestNestedMenuContent" />, | ||
<Menu.Item text="Default 2.7" key="2.7" className="TestNestedMenuContent" />, | ||
<Menu.Item text="Default 2.8" key="2.8" className="TestNestedMenuContent" />, | ||
<Menu.Item text="Default 2.9" key="2.9" className="TestNestedMenuContent" />, | ||
<Menu.Item text="Default 3.0" key="3.0" className="TestNestedMenuContent" />, | ||
<Menu.Item text="Default 3.1" key="3.1" className="TestNestedMenuContent" />, | ||
<Menu.Item text="Default 3.2" key="3.2" className="TestNestedMenuContent" />, | ||
<Menu.Item text="Default 3.1" key="3.3" className="TestNestedMenuContent" />, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: It should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed here 9515f20 |
||
]} | ||
/> | ||
<Menu.Item text="Default 3" key="3" /> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we update this descriptions o it's meaningful to users? Maybe something like we removed the fix height in sub-menus or we allow sub-menu's height to be determined by it's content?