Skip to content

Commit

Permalink
close rename dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayadav09 committed Feb 19, 2024
1 parent 3cf84ab commit cf361ea
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/OnboardingSPA/steps/SiteGen/Editor/Header/center.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,31 @@ const DropDownMenu = memo(
onRenameItemSelect,
onViewAll,
isLargeViewport,
onToggle,
} ) => {
const onMenuItemClick = ( action ) => () => {
action();
onToggle();
};
return (
<MenuGroup className="nfd-onboarding-header__version_dropdown-menu">
{ ! isLargeViewport && (
<>
<MenuItem onClick={ onRegenerate }>
<MenuItem onClick={ onMenuItemClick( onRegenerate ) }>
<Icon icon={ reusableBlock } />
{ __( 'Regenerate', 'wp-module-onboarding' ) }
</MenuItem>
<MenuItem onClick={ onCustomize }>
<MenuItem onClick={ onMenuItemClick( onCustomize ) }>
<div className="nfd-onboarding-header__version_dropdown-menu__customize-button__icon"></div>
{ __( 'Customize', 'wp-module-onboarding' ) }
</MenuItem>
</>
) }

<MenuItem onClick={ onRenameItemSelect }>
<MenuItem onClick={ onMenuItemClick( onRenameItemSelect ) }>
{ __( 'Rename', 'wp-module-onboarding' ) }
</MenuItem>
<MenuItem onClick={ onViewAll }>
<MenuItem onClick={ onMenuItemClick( onViewAll ) }>
{ __( 'View All', 'wp-module-onboarding' ) }
</MenuItem>
</MenuGroup>
Expand Down Expand Up @@ -126,13 +131,14 @@ const TitleContent = memo(
/>
</div>
) }
renderContent={ () => (
renderContent={ ( { onToggle } ) => (
<DropDownMenu
onRegenerate={ onRegenerate }
onCustomize={ onCustomize }
onRenameItemSelect={ onRenameItemSelect }
onViewAll={ onViewAll }
isLargeViewport={ isLargeViewport }
onToggle={ onToggle }
/>
) }
/>
Expand Down

0 comments on commit cf361ea

Please sign in to comment.