bruno/packages/grafnode-components/src/components/Navbar/index.js

52 lines
1.7 KiB
JavaScript
Raw Normal View History

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';
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>
);
});
return (
<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>
)
};
export default Navbar;