2022-01-31 06:06:29 +01:00
|
|
|
import React, { useState, forwardRef, useRef } from 'react';
|
|
|
|
import Dropdown from '../Dropdown';
|
2021-12-03 19:46:54 +01:00
|
|
|
import { faCaretDown } from "@fortawesome/free-solid-svg-icons";
|
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
2022-01-31 06:06:29 +01:00
|
|
|
import { IconBox, IconSearch, IconDots } from '@tabler/icons';
|
2021-12-03 19:46:54 +01:00
|
|
|
import StyledWrapper from './StyledWrapper';
|
2021-12-03 19:04:48 +01:00
|
|
|
|
|
|
|
const Navbar = () => {
|
2022-01-31 06:06:29 +01:00
|
|
|
const [modalOpen, setModalOpen] = useState(false);
|
|
|
|
|
|
|
|
const menuDropdownTippyRef = useRef();
|
|
|
|
const onMenuDropdownCreate = (ref) => menuDropdownTippyRef.current = ref;
|
|
|
|
const MenuIcon = forwardRef((props, ref) => {
|
|
|
|
return (
|
|
|
|
<div ref={ref} className="dropdown-icon cursor-pointer">
|
|
|
|
<IconDots size={22}/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2021-12-03 19:04:48 +01:00
|
|
|
return (
|
2021-12-10 19:34:00 +01:00
|
|
|
<StyledWrapper className="px-2 py-2 flex items-center">
|
2022-01-31 06:06:29 +01:00
|
|
|
<div>
|
|
|
|
<span className="ml-2">My Workspace</span>
|
|
|
|
<FontAwesomeIcon className="ml-2" icon={faCaretDown} style={{fontSize: 13}}/>
|
|
|
|
</div>
|
|
|
|
<div className="collection-dropdown flex flex-grow items-center justify-end">
|
|
|
|
<Dropdown onCreate={onMenuDropdownCreate} icon={<MenuIcon />} placement='bottom-start'>
|
|
|
|
<div className="dropdown-item" onClick={(e) => {
|
|
|
|
menuDropdownTippyRef.current.hide();
|
|
|
|
setModalOpen(true);
|
|
|
|
}}>
|
|
|
|
Create Collection
|
|
|
|
</div>
|
|
|
|
<div className="dropdown-item" onClick={(e) => {
|
|
|
|
menuDropdownTippyRef.current.hide();
|
|
|
|
}}>
|
|
|
|
Import Collection
|
|
|
|
</div>
|
|
|
|
<div className="dropdown-item" onClick={(e) => {
|
|
|
|
menuDropdownTippyRef.current.hide();
|
|
|
|
}}>
|
|
|
|
Settings
|
|
|
|
</div>
|
|
|
|
</Dropdown>
|
|
|
|
</div>
|
2021-12-03 19:46:54 +01:00
|
|
|
</StyledWrapper>
|
2021-12-03 19:04:48 +01:00
|
|
|
)
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Navbar;
|