import React, { useState } from 'react'; import Button from '../Button'; import Icon from '../Icon'; import Divider from '../Divider'; import Box from '../Box'; import Sliders from '../Sliders'; import ColorSelector from '../../containers/ColorSelector'; import { Container, Subtitle, SliderWrapper } from './styled'; type Props = { onUpdate: OnUpdateType; onDelete: () => void; colorProps?: string; opacityProps?: number; }; const AnnotationOptions: React.FC = ({ onUpdate, onDelete, colorProps, opacityProps, }: Props) => { const [openSlider, setSlider] = useState(false); const [opacity, setOpacity] = useState(opacityProps); const handleClick = (color: string): void => { onUpdate({ bdcolor: color }); }; const handleChange = (value: number): void => { setOpacity(value); onUpdate({ transparency: value * 0.01 }); }; const sliderToggle = (e: React.MouseEvent): void => { e.preventDefault(); setSlider(!openSlider); }; return ( {openSlider && ( <> {`${opacity} %`} )} {!openSlider && ( <> opacity )} ); }; export default AnnotationOptions;