-
Notifications
You must be signed in to change notification settings - Fork 55
Conversation
Codecov Report
@@ Coverage Diff @@
## master #73 +/- ##
==========================================
- Coverage 86.27% 86.05% -0.22%
==========================================
Files 39 39
Lines 663 667 +4
Branches 99 102 +3
==========================================
+ Hits 572 574 +2
- Misses 88 90 +2
Partials 3 3
Continue to review full report at Codecov.
|
src/components/Menu/MenuItem.tsx
Outdated
{this.props.icon && | ||
Icon.create(this.props.icon, { | ||
defaultProps: { xSpacing: !!content ? 'after' : 'none' }, | ||
})} | ||
{content} |
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.
Should we consider using the Layout component for aligning the content inside the MenuItem? Are there going to be other types of menus with media in the start and end?
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.
Good point. I would suggest leaving it as it is for now and refactor by adding Layout
later as new requirements for the component come.
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.
Sure!
render() { | ||
return <Menu icons defaultActiveIndex={0} items={items} /> | ||
} | ||
} |
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.
This could be stateless for brevity.
<Menu.Item active={activeItem === 'a'} onClick={this.handleItemClick('a')}> | ||
<Icon name="home" xSpacing="after" /> | ||
Home | ||
</Menu.Item> |
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.
If we are removing shorthand, shouldn't this example be removed?
examplePath="components/Menu/Variations/MenuExampleWithIcons" | ||
/> | ||
<ComponentExample | ||
title="Vertical Menu with Icons" |
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.
Titles should reflect props when possible:
"Vertical Icon" for <Menu vertical icon />
src/components/Menu/MenuItem.tsx
Outdated
@@ -89,6 +98,10 @@ class MenuItem extends UIComponent<any, any> { | |||
onClick={this.handleClick} | |||
{...accessibility.attributes.anchor} | |||
> | |||
{this.props.icon && |
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.
Please use destructuring for consistency.
src/components/Menu/Menu.tsx
Outdated
@@ -60,6 +63,7 @@ class Menu extends AutoControlledComponent<any, any> { | |||
'className', | |||
'defaultActiveIndex', | |||
'fluid', | |||
'icons', |
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.
icon
and icons
props may confuse users. Proposal:
There is no icon
prop for Menu yet, propose we use <Menu icon />
to signify the type of the menu.
There is an icon
prop already for Menu.Item, propose we use <Menu.item iconOnly />
to signify there is an icon only and no content.
Thoughts?
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.
- Agree that
icon
vsicons
onMenuItem
is confusing. - But in your proposal
icon
property means something different inMenu
andMenuItem
- are we ok with that? - Or we can use
iconOnly
inMenu
as well.
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.
Let's go with iconOnly
for now, I will post an RFC about icon type components. There are many considerations beyond the scope of this PR.
API Proposal
stardust-ui/react-old#121
Menu Items with icons
MenuItems can now contain icons:
Menu can also consist of Icons only (no text):
Icons only menu intentionally has no spacing between items. In Teams, the free space around the icons is part of the SVG icons. If there is spacing required, it can be achived using
IMenuVariables.iconsMenuItemSpacing
Problems
TODO