Reverse direction of menu items within drop-down owners list
Brian Vaughn committed
Apr 25, 2019 at 14:10 UTC
e88819a22ec1e62b3af1dbae046f0c329c623491
1 file changed
+15
-11
src/devtools/views/Components/OwnersStack.js
+15
-11
@@ -92,6 +92,20 @@ function ElementsDropdown({
92
const store = useContext(StoreContext);
93
const dispatch = useContext(TreeDispatcherContext);
94
95
+ const menuItems = [];
96
+ for (let index = ownerStack.length - 1; index >= 0; index--) {
97
+ const id = ownerStack[index];
98
+ menuItems.push(
99
+ <MenuItem
100
+ key={id}
101
+ className={styles.Component}
102
+ onSelect={() => dispatch({ type: 'SELECT_OWNER', payload: id })}
103
+ >
104
+ {((store.getElementByID(id): any): Element).displayName}
105
+ </MenuItem>
106
+ );
107
+ }
108
+
109
return (
110
<Menu>
111
<MenuButton className={styles.MenuButton}>
@@ -101,17 +115,7 @@ function ElementsDropdown({
115
</span>
116
</Tooltip>
117
</MenuButton>
104
- <MenuList className={styles.Modal}>
105
- {ownerStack.map((id, index) => (
106
- <MenuItem
107
- key={id}
108
- className={styles.Component}
109
- onSelect={() => dispatch({ type: 'SELECT_OWNER', payload: id })}
110
- >
111
- {((store.getElementByID(id): any): Element).displayName}
112
- </MenuItem>
113
- ))}
114
- </MenuList>
118
+ <MenuList className={styles.Modal}>{menuItems}</MenuList>
119
</Menu>
120
);
121
}