diff --git a/native/components/color-selector-button.react.js b/native/components/color-selector-button.react.js --- a/native/components/color-selector-button.react.js +++ b/native/components/color-selector-button.react.js @@ -1,28 +1,49 @@ // @flow import * as React from 'react'; -import { View, StyleSheet } from 'react-native'; +import { StyleSheet, TouchableOpacity, View } from 'react-native'; +import tinycolor from 'tinycolor2'; type ColorSelectorButtonProps = { - color: string, + +color: string, + +currentColor: string, }; function ColorSelectorButton(props: ColorSelectorButtonProps): React.Node { - const { color } = props; - const buttonStyle = React.useMemo( - () => [styles.button, { backgroundColor: color }], - [color], + const { color, currentColor } = props; + + const colorSplotchStyle = React.useMemo(() => { + return [styles.button, { backgroundColor: `#${color}` }]; + }, [color]); + + const isSelected = tinycolor.equals(currentColor, color); + return ( + + + ); - return ; } const styles = StyleSheet.create({ button: { borderRadius: 20, height: 40, - margin: 15, + margin: 10, width: 40, }, + outerRing: { + borderRadius: 40, + height: 60, + margin: 5, + width: 60, + }, + outerRingSelected: { + backgroundColor: '#404040', + borderRadius: 40, + height: 60, + margin: 5, + width: 60, + }, }); export default ColorSelectorButton; diff --git a/native/components/color-selector.react.js b/native/components/color-selector.react.js --- a/native/components/color-selector.react.js +++ b/native/components/color-selector.react.js @@ -3,26 +3,35 @@ import * as React from 'react'; import { Text, View, StyleSheet } from 'react-native'; +import { selectedThreadColors } from 'lib/shared/thread-utils'; + import ColorSelectorButton from './color-selector-button.react'; -function ColorSelector(): React.Node { +type ColorSelectorProps = { + +currentColor: string, +}; + +function ColorSelector(props: ColorSelectorProps): React.Node { + const { currentColor } = props; + + const colorSelectorButtons = React.useMemo( + () => + selectedThreadColors.map(color => ( + + )), + [currentColor], + ); + return ( Select thread color - - - - - - - - - - - - + {colorSelectorButtons} ); }