import React, { forwardRef, useRef } from 'react'; import { IconChevronRight, IconDots } from '@tabler/icons'; import CollectionItem from './CollectionItem'; import Dropdown from '../../../Dropdown'; import get from 'lodash/get'; import classnames from 'classnames'; import StyledWrapper from './StyledWrapper'; const Collection = ({collection, actions, dispatch, activeRequestTabId}) => { const envDropdownTippyRef = useRef(); const menuDropdownTippyRef = useRef(); const onMenuDropdownCreate = (ref) => menuDropdownTippyRef.current = ref; const MenuIcon = forwardRef((props, ref) => { return (
); }); const iconClassName = classnames({ 'rotate-90': collection.collapsed }); const handleClick = (event) => { let envTippyEl = get(envDropdownTippyRef, 'current.reference'); if(envTippyEl && envTippyEl.contains && envTippyEl.contains(event.target)) { return; } dispatch({ type: actions.SIDEBAR_COLLECTION_CLICK, id: collection.id }); }; return (
{collection.name}
} placement='bottom-start'>
{ menuDropdownTippyRef.current.hide(); }}> Add Request
{ menuDropdownTippyRef.current.hide(); }}> Add Folder
{collection.collapsed ? (
{collection.items && collection.items.length ? collection.items.map((i) => { return }) : null}
) : null}
); }; export default Collection;