mirror of
https://ghproxy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-07-22 12:27:13 +08:00
* add: getting started modal * update: modal logic and rendering * fix: menu alignment * update: mixpanel events * fix: move function to named function * fix: icon imports
61 lines
1.3 KiB
JavaScript
61 lines
1.3 KiB
JavaScript
import ChevronDownIcon from '@elementor/icons/ChevronDownIcon';
|
|
import HelpIcon from '@elementor/icons/HelpIcon';
|
|
import Button from '@elementor/ui/Button';
|
|
import {
|
|
bindMenu,
|
|
bindTrigger,
|
|
usePopupState,
|
|
} from '@elementor/ui/usePopupState';
|
|
import { mixpanelEvents, mixpanelService } from '@ea11y-apps/global/services';
|
|
import { __ } from '@wordpress/i18n';
|
|
import { HelpPopupMenu } from './popup-menu';
|
|
|
|
const HelpMenu = () => {
|
|
const helpMenuState = usePopupState({
|
|
variant: 'popover',
|
|
popupId: 'helpMenu',
|
|
});
|
|
|
|
const triggerProps = bindTrigger(helpMenuState);
|
|
const handleHelpButtonClick = (e) => {
|
|
triggerProps.onClick(e);
|
|
mixpanelService.sendEvent(mixpanelEvents.menuButtonClicked, {
|
|
buttonName: 'Help',
|
|
});
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<Button
|
|
{...triggerProps}
|
|
size="medium"
|
|
color="secondary"
|
|
aria-label={__('Help', 'pojo-accessibility')}
|
|
startIcon={
|
|
<HelpIcon
|
|
role="presentation"
|
|
sx={{ color: 'common.black' }}
|
|
fontSize="small"
|
|
/>
|
|
}
|
|
endIcon={
|
|
<ChevronDownIcon
|
|
role="presentation"
|
|
sx={{ color: 'common.black' }}
|
|
fontSize="small"
|
|
/>
|
|
}
|
|
onClick={handleHelpButtonClick}
|
|
>
|
|
{__('Help', 'pojo-accessibility')}
|
|
</Button>
|
|
|
|
<HelpPopupMenu
|
|
{...bindMenu(helpMenuState)}
|
|
closeAction={helpMenuState.close}
|
|
/>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default HelpMenu;
|