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,15 +3,19 @@ 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, - +active: boolean, + +pendingColorSelection: string, + +setPendingColorSelection: SetState, }; function ColorSelectorButton(props: ColorSelectorButtonProps): React.Node { - const { color, active } = props; + const { color, pendingColorSelection, setPendingColorSelection } = props; + const active = color === pendingColorSelection; const containerClassName = classNames(css.container, { [css.active]: active, }); @@ -23,8 +27,12 @@ [color], ); + const onColorSplotchClicked = React.useCallback(() => { + setPendingColorSelection(color); + }, [setPendingColorSelection, 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 @@ -5,22 +5,70 @@ import ColorSelectorButton from './color-selector-button.react'; import css from './color-selector.css'; -function ColorSelector(): React.Node { +type ColorSelectorProps = { + +currentThreadColor: string, +}; +function ColorSelector(props: ColorSelectorProps): React.Node { + const { currentThreadColor } = props; + const [pendingColorSelection, setPendingColorSelection] = React.useState( + currentThreadColor, + ); + return (
- - - - - + + + + +
- - - - - + + + + +
);