import React from 'react'; import _ from 'lodash'; import styled from 'styled-components'; import { contextMenu } from 'react-contexify'; type SProps = { onArrowClick: (e: React.MouseEvent) => void; onMainButtonClick: (e: React.MouseEvent) => void; isMuted?: boolean; hidePopoverArrow?: boolean; iconType: 'microphone' | 'camera' | 'volume'; }; const StyledRoundedButton = styled.div<{ isMuted: boolean }>` background-color: ${props => (props.isMuted ? 'hsl(0,0%,40%)' : 'white')}; color: ${props => (props.isMuted ? 'white' : 'black')}; border-radius: 50%; cursor: pointer; transition-duration: 0.25s; &:hover { opacity: 1; } `; const StyledContainer = styled(StyledRoundedButton)` width: 60px; height: 60px; margin: 10px; opacity: 0.4; &:hover { opacity: 1; } `; const StyledMainIcon = styled.div` padding: 20px; `; const StyledArrowIcon = styled(StyledRoundedButton)` width: 35%; height: 35%; position: relative; top: -35%; right: -65%; box-shadow: 0 0 4px 0 #b4b4b4; `; const CameraIcon = ( ); const SpeakerIcon = ( ); const MicrophoneIcon = ( ); export const DropDownAndToggleButton = (props: SProps) => { const { iconType, hidePopoverArrow, onArrowClick, onMainButtonClick, isMuted } = props; const arrowClickHandler = (e: React.MouseEvent) => { e.stopPropagation(); onArrowClick(e); }; const mainButtonClickHandler = (e: React.MouseEvent) => { e.stopPropagation(); contextMenu.hideAll(); onMainButtonClick(e); }; const iconToRender = iconType === 'microphone' ? MicrophoneIcon : iconType === 'camera' ? CameraIcon : SpeakerIcon; return ( {iconToRender} {!hidePopoverArrow && ( )} ); };