import React from 'react' import Popout from './Popout' import Button from './Button' import ColorPicker from './ColorPicker' import { COLORS } from '../lib/constants' function ModifierButton(props) { return ( props.onChange(s => !s)} > {props.children} ) } function SelectionEditor({ position, onChange }) { const [open, setOpen] = React.useState(false) const [bold, setBold] = React.useState(false) const [italics, setItalics] = React.useState(false) const [underline, setUnderline] = React.useState(false) const [color, setColor] = React.useState(null) React.useEffect(() => { onChange({ bold, italics, underline, color }) }, [onChange, bold, color, italics, underline]) return ( B I U setOpen(o => !o)} /> {open && ( setColor(d.hex)} /> )} ) } export default SelectionEditor