Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3371496
D8306.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D8306.diff
View Options
diff --git a/web/components/menu-item.react.js b/web/components/menu-item.react.js
--- a/web/components/menu-item.react.js
+++ b/web/components/menu-item.react.js
@@ -10,25 +10,36 @@
import Button from './button.react.js';
import css from './menu.css';
-type MenuItemProps = {
+type MenuItemPropsBase = {
+onClick?: () => mixed,
- +icon: Icon,
+text: string,
+dangerous?: boolean,
};
+type MenuItemProps =
+ | {
+ ...MenuItemPropsBase,
+ +icon: Icon,
+ }
+ | {
+ ...MenuItemPropsBase,
+ +iconComponent: React.Node,
+ };
function MenuItem(props: MenuItemProps): React.Node {
- const { onClick, icon, text, dangerous } = props;
+ const { onClick, icon, iconComponent, text, dangerous } = props;
const itemClasses = classNames(css.menuAction, {
[css.menuActionDangerous]: dangerous,
});
+ let menuItemIcon = iconComponent;
+ if (icon) {
+ menuItemIcon = <SWMansionIcon size="100%" icon={icon} />;
+ }
+
return (
<Button className={itemClasses} onClick={onClick}>
- <div className={css.menuActionIcon}>
- <SWMansionIcon size="100%" icon={icon} />
- </div>
+ <div className={css.menuActionIcon}>{menuItemIcon}</div>
<div>{text}</div>
</Button>
);
diff --git a/web/components/menu.css b/web/components/menu.css
--- a/web/components/menu.css
+++ b/web/components/menu.css
@@ -12,6 +12,7 @@
flex-direction: column;
background-color: var(--menu-bg);
color: var(--menu-color);
+ stroke: var(--menu-color);
border-radius: 4px;
padding: 4px 0;
line-height: var(--line-height-text);
@@ -28,6 +29,7 @@
font-size: var(--xs-font-12);
background-color: var(--menu-bg-light);
color: var(--menu-color-light);
+ stroke: var(--menu-color-light);
top: 0;
right: 5px;
}
@@ -36,6 +38,7 @@
font-size: var(--m-font-16);
background-color: var(--menu-bg-light);
color: var(--menu-color);
+ stroke: var(--menu-color);
top: 24px;
}
@@ -50,6 +53,7 @@
button.menuAction:hover {
color: var(--menu-color-hover);
+ stroke: var(--menu-color-hover);
}
div.menuActionIcon {
@@ -67,9 +71,11 @@
button.menuActionDangerous {
color: var(--menu-color-dangerous);
+ stroke: var(--menu-color-dangerous);
}
button.menuActionDangerous:hover {
color: var(--menu-color-dangerous-hover);
+ stroke: var(--menu-color-dangerous-hover);
}
hr.separator {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 4:47 AM (19 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2588349
Default Alt Text
D8306.diff (2 KB)
Attached To
Mode
D8306: [web] Allow other types of icons in menu item
Attached
Detach File
Event Timeline
Log In to Comment