The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/client/sidebar/header/actions/Sort.js

29 lines
744 B

import { Box, Sidebar, Dropdown } from '@rocket.chat/fuselage';
import React, { useRef } from 'react';
import { createPortal } from 'react-dom';
import SortList from '../../../components/SortList';
import { useDropdownVisibility } from '../hooks/useDropdownVisibility';
const Sort = (props) => {
const reference = useRef(null);
const target = useRef(null);
const { isVisible, toggle } = useDropdownVisibility({ reference, target });
return (
<>
<Box ref={reference}>
<Sidebar.TopBar.Action {...props} icon='sort' onClick={toggle} />
</Box>
{isVisible &&
createPortal(
<Dropdown reference={reference} ref={target}>
<SortList />
</Dropdown>,
document.body,
)}
</>
);
};
export default Sort;