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/providers/SidebarProvider.tsx

24 lines
641 B

import React, { FC } from 'react';
import { menu } from '../../app/ui-utils/client';
import { SidebarContext } from '../contexts/SidebarContext';
import { useReactiveValue } from '../hooks/useReactiveValue';
const getOpen = (): boolean => menu.isOpen();
const setOpen = (open: boolean | ((isOpen: boolean) => boolean)): void => {
if (typeof open === 'function') {
open = open(menu.isOpen());
}
return open ? menu.open() : menu.close();
};
const SidebarProvider: FC = ({ children }) => (
<SidebarContext.Provider
children={children}
value={[useReactiveValue<boolean>(getOpen), setOpen]}
/>
);
export default SidebarProvider;