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 @@ -3,33 +3,31 @@ import classNames from 'classnames'; import * as React from 'react'; -import { type SetState } from 'lib/types/hook-types.js'; - import css from './color-selector-button.css'; type ColorSelectorButtonProps = { +color: string, - +pendingColorSelection: string, - +setPendingColorSelection: SetState, + +currentColor: string, + +onColorSelection: (hex: string) => void, }; function ColorSelectorButton(props: ColorSelectorButtonProps): React.Node { - const { color, pendingColorSelection, setPendingColorSelection } = props; + const { color, currentColor, onColorSelection } = props; - const active = color === pendingColorSelection; + const active = color === currentColor; const containerClassName = classNames(css.container, { [css.active]: active, }); const colorSplotchStyle = React.useMemo( () => ({ - backgroundColor: color, + backgroundColor: `#${color}`, }), [color], ); const onColorSplotchClicked = React.useCallback(() => { - setPendingColorSelection(color); - }, [setPendingColorSelection, color]); + onColorSelection(color); + }, [onColorSelection, color]); return (
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 @@ -6,68 +6,66 @@ import css from './color-selector.css'; type ColorSelectorProps = { - +currentThreadColor: string, + +currentColor: string, + +onColorSelection: (hex: string) => void, }; function ColorSelector(props: ColorSelectorProps): React.Node { - const { currentThreadColor } = props; - const [pendingColorSelection, setPendingColorSelection] = React.useState( - currentThreadColor, - ); + const { currentColor, onColorSelection } = props; return (