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/apps/meteor/client/components/message/hooks/useCollapse.tsx

12 lines
674 B

import { useToggle } from '@rocket.chat/fuselage-hooks';
import { useAttachmentIsCollapsedByDefault } from '@rocket.chat/ui-contexts';
import type { ReactNode } from 'react';
import React from 'react';
import CollapsibleContent from '../content/collapsible/CollapsibleContent';
export const useCollapse = (attachmentCollapsed?: boolean): [collapsed: boolean, node: ReactNode] => {
const collpaseByDefault = useAttachmentIsCollapsedByDefault();
const [collapsed, toogleCollapsed] = useToggle(collpaseByDefault || attachmentCollapsed);
return [collapsed, <CollapsibleContent collapsed={collapsed} onClick={toogleCollapsed as any} key='collapsible-content-action' />];
};