import React from 'react' import ImagePicker from './ImagePicker' import ColorPicker from './ColorPicker' import Button from './Button' import Popout, { managePopout } from './Popout' import { COLORS, DEFAULT_BG_COLOR } from '../lib/constants' import { capitalize, stringifyRGBA } from '../lib/util' function validateColor(str) { if (/#\d{3,6}|rgba{0,1}\(.*?\)/gi.test(str) || /\w+/gi.test(str)) { return str } } class BackgroundSelect extends React.PureComponent { selectTab = name => { if (this.props.mode !== name) { this.props.onChange({ backgroundMode: name }) } } handlePickColor = ({ rgb }) => this.props.onChange({ backgroundColor: stringifyRGBA(rgb) }) render() { const { color, mode, image, onChange, isVisible, toggleVisibility, carbonRef, updateHighlights } = this.props const background = validateColor(color) ? color : DEFAULT_BG_COLOR const aspectRatio = carbonRef ? carbonRef.clientWidth / carbonRef.clientHeight : 1 return (
) } } export default managePopout(BackgroundSelect)