2022-01-02 09:15:13 +01:00
|
|
|
import React, { forwardRef, useRef } from 'react';
|
2021-12-03 20:37:38 +01:00
|
|
|
import Collections from './Collections';
|
2021-12-10 19:34:00 +01:00
|
|
|
import Navbar from '../Navbar';
|
2022-01-02 09:15:13 +01:00
|
|
|
import Dropdown from '../Dropdown';
|
|
|
|
import { IconBox, IconSearch, IconDots } from '@tabler/icons';
|
|
|
|
import StyledWrapper from './StyledWrapper';
|
2021-12-03 20:37:38 +01:00
|
|
|
|
|
|
|
const Sidebar = ({collections, actions, dispatch, activeRequestTabId}) => {
|
2022-01-02 09:15:13 +01:00
|
|
|
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 20:37:38 +01:00
|
|
|
return (
|
2022-01-02 09:15:13 +01:00
|
|
|
<StyledWrapper>
|
2021-12-10 19:34:00 +01:00
|
|
|
<Navbar />
|
2022-01-01 10:07:34 +01:00
|
|
|
|
2022-01-02 09:15:13 +01:00
|
|
|
<div className="mt-4 px-2 py-1 flex collection-title">
|
|
|
|
<IconBox size={22} strokeWidth={1.5}/>
|
2022-01-01 10:07:34 +01:00
|
|
|
<span className="ml-2">Collections</span>
|
2022-01-02 09:15:13 +01:00
|
|
|
<div className="collection-dropdown flex flex-grow items-center justify-end">
|
|
|
|
<Dropdown onCreate={onMenuDropdownCreate} icon={<MenuIcon />} placement='bottom-start'>
|
|
|
|
<div>
|
|
|
|
<div className="dropdown-item" onClick={(e) => {
|
|
|
|
menuDropdownTippyRef.current.hide();
|
|
|
|
}}>
|
|
|
|
Create Collection
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<div className="dropdown-item" onClick={(e) => {
|
|
|
|
menuDropdownTippyRef.current.hide();
|
|
|
|
}}>
|
|
|
|
Settings
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Dropdown>
|
|
|
|
</div>
|
2021-12-03 20:37:38 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="mt-4 relative collection-filter px-2">
|
|
|
|
<div className="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none">
|
|
|
|
<span className="text-gray-500 sm:text-sm">
|
|
|
|
<IconSearch size={16} strokeWidth={1.5}/>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
name="price"
|
|
|
|
id="price"
|
|
|
|
className="block w-full pl-7 py-1 sm:text-sm"
|
|
|
|
placeholder="search"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<Collections
|
|
|
|
collections={collections}
|
|
|
|
actions={actions}
|
|
|
|
dispatch={dispatch}
|
|
|
|
activeRequestTabId={activeRequestTabId}
|
|
|
|
/>
|
2022-01-02 09:15:13 +01:00
|
|
|
</StyledWrapper>
|
2021-12-03 20:37:38 +01:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Sidebar;
|