Refactor DropDownMenu to use onToggle method for event tracking

MAILPOET-6365
This commit is contained in:
Oluwaseun Olorunsola
2024-12-19 21:22:29 +01:00
committed by Oluwaseun Olorunsola
parent e73ffc1a79
commit 1e21223a73

View File

@@ -69,18 +69,18 @@ export function EmailTypeInfo() {
'Template actions', 'Template actions',
'mailpoet' 'mailpoet'
) } ) }
> onToggle={ ( isOpen ) =>
{ ( { onClose, isOpen } ) => {
if ( isOpen ) {
recordEvent( recordEvent(
'sidebar_template_actions_clicked', 'sidebar_template_actions_clicked',
{ {
currentTemplate: currentTemplate:
template?.title, template?.title,
isOpen,
} }
); )
} }
return ( >
{ ( { onClose } ) => (
<> <>
<MenuItem <MenuItem
onClick={ () => { onClick={ () => {
@@ -115,8 +115,7 @@ export function EmailTypeInfo() {
) } ) }
</MenuItem> </MenuItem>
</> </>
); ) }
} }
</DropdownMenu> </DropdownMenu>
</FlexItem> </FlexItem>
</Flex> </Flex>