The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import type { ReactNode } from 'react';
import { Collapsible } from 'twenty-ui/primitives/layout';
import { NavigationDrawerAnimatedCollapseWrapper } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper';
import { NavigationDrawerSection } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSection';
import { NavigationDrawerSectionTitle } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle';
type NavigationMenuItemSectionProps = {
title: string;
isOpen: boolean;
onToggle: () => void;
rightIcon?: ReactNode;
alwaysShowRightIcon?: boolean;
forceExpanded?: boolean;
children: ReactNode;
contentWrapper?: (children: ReactNode) => ReactNode;
};
export const NavigationMenuItemSection = ({
title,
isOpen,
onToggle,
rightIcon,
alwaysShowRightIcon,
forceExpanded = false,
children,
contentWrapper,
}: NavigationMenuItemSectionProps) => {
const content = (
<Collapsible.Root open={isOpen || forceExpanded}>
<Collapsible.Panel dimension="height" containAnimation>
{children}
</Collapsible.Panel>
</Collapsible.Root>
);
return (
<NavigationDrawerSection>
<NavigationDrawerAnimatedCollapseWrapper>
<NavigationDrawerSectionTitle
label={title}
onClick={onToggle}
rightIcon={rightIcon}
alwaysShowRightIcon={alwaysShowRightIcon}
isOpen={isOpen}
/>
</NavigationDrawerAnimatedCollapseWrapper>
{contentWrapper ? contentWrapper(content) : content}
</NavigationDrawerSection>
);
};