import React from 'react' import { escape } from 'escape-goat' import ImagePicker from './ImagePicker' import ColorPicker from './ColorPicker' import Popout, { managePopout } from './Popout' import { COLORS, DEFAULT_BG_COLOR } from '../lib/constants' import { validateColor } from '../lib/colors' import { capitalize, stringifyRGBA } from '../lib/util' 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 } = this.props let background = typeof color === 'string' ? escape(color).replace(/\//g, '/') : color if (!validateColor(background)) { background = DEFAULT_BG_COLOR } const aspectRatio = carbonRef ? carbonRef.clientWidth / carbonRef.clientHeight : 1 return (
) } } export default managePopout(BackgroundSelect)