diff --git a/web/modals/threads/color-selector-button.react.js b/web/modals/threads/color-selector-button.react.js --- a/web/modals/threads/color-selector-button.react.js +++ b/web/modals/threads/color-selector-button.react.js @@ -7,10 +7,16 @@ type ColorSelectorButtonProps = { +color: string, - +active: boolean, + +pendingColorSelection: string, + +setPendingColorSelection: string => void, }; function ColorSelectorButton(props: ColorSelectorButtonProps): React.Node { - const { color, active } = props; + const { color, pendingColorSelection, setPendingColorSelection } = props; + + const active = React.useMemo(() => color === pendingColorSelection, [ + color, + pendingColorSelection, + ]); const containerClassName = classNames(css.container, { [css.active]: active, @@ -23,8 +29,12 @@ [color], ); + const onColorSplotchClicked = React.useCallback(() => { + setPendingColorSelection(color); + }, [setPendingColorSelection, color]); + return ( -