Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3393483
D3704.id11370.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
D3704.id11370.diff
View Options
diff --git a/web/modals/threads/color-selector.react.js b/web/modals/threads/color-selector.react.js
--- a/web/modals/threads/color-selector.react.js
+++ b/web/modals/threads/color-selector.react.js
@@ -14,60 +14,20 @@
function ColorSelector(props: ColorSelectorProps): React.Node {
const { currentColor, onColorSelection } = props;
- return (
- <div className={css.container}>
- <ColorSelectorButton
- color={selectedThreadColors[0]}
- currentColor={currentColor}
- onColorSelection={onColorSelection}
- />
- <ColorSelectorButton
- color={selectedThreadColors[1]}
- currentColor={currentColor}
- onColorSelection={onColorSelection}
- />
- <ColorSelectorButton
- color={selectedThreadColors[2]}
- currentColor={currentColor}
- onColorSelection={onColorSelection}
- />
- <ColorSelectorButton
- color={selectedThreadColors[3]}
- currentColor={currentColor}
- onColorSelection={onColorSelection}
- />
- <ColorSelectorButton
- color={selectedThreadColors[4]}
- currentColor={currentColor}
- onColorSelection={onColorSelection}
- />
- <ColorSelectorButton
- color={selectedThreadColors[5]}
- currentColor={currentColor}
- onColorSelection={onColorSelection}
- />
- <ColorSelectorButton
- color={selectedThreadColors[6]}
- currentColor={currentColor}
- onColorSelection={onColorSelection}
- />
- <ColorSelectorButton
- color={selectedThreadColors[7]}
- currentColor={currentColor}
- onColorSelection={onColorSelection}
- />
- <ColorSelectorButton
- color={selectedThreadColors[8]}
- currentColor={currentColor}
- onColorSelection={onColorSelection}
- />
- <ColorSelectorButton
- color={selectedThreadColors[9]}
- currentColor={currentColor}
- onColorSelection={onColorSelection}
- />
- </div>
+ const colorSelectorButtons = React.useMemo(
+ () =>
+ selectedThreadColors.map(color => (
+ <ColorSelectorButton
+ key={color}
+ color={color}
+ currentColor={currentColor}
+ onColorSelection={onColorSelection}
+ />
+ )),
+ [currentColor, onColorSelection],
);
+
+ return <div className={css.container}>{colorSelectorButtons}</div>;
}
export default ColorSelector;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 2:24 PM (20 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605211
Default Alt Text
D3704.id11370.diff (2 KB)
Attached To
Mode
D3704: [web] Create `ColorSelectorButton`s in `ColorSelector` iteratively to reduce repetition
Attached
Detach File
Event Timeline
Log In to Comment