| 1 |
import { useContext } from 'react'; |
| 2 |
import { OnboardingContext } from '../../context/context'; |
| 3 |
import Grid from 'elementor-app/ui/grid/grid'; |
| 4 |
import GoProPopover from '../go-pro-popover'; |
| 5 |
import HeaderButtons from 'elementor-app/layout/header-buttons'; |
| 6 |
import usePageTitle from 'elementor-app/hooks/use-page-title'; |
| 7 |
|
| 8 |
export default function Header( props ) { |
| 9 |
usePageTitle( { title: props.title } ); |
| 10 |
|
| 11 |
const { state } = useContext( OnboardingContext ); |
| 12 |
|
| 13 |
const onClose = () => { |
| 14 |
elementorCommon.events.dispatchEvent( { |
| 15 |
event: 'close modal', |
| 16 |
version: '', |
| 17 |
details: { |
| 18 |
placement: elementorAppConfig.onboarding.eventPlacement, |
| 19 |
step: state.currentStep, |
| 20 |
}, |
| 21 |
} ); |
| 22 |
|
| 23 |
window.top.location = elementorAppConfig.admin_url; |
| 24 |
}; |
| 25 |
|
| 26 |
return ( |
| 27 |
<Grid container alignItems="center" justify="space-between" className="eps-app__header e-onboarding__header"> |
| 28 |
<div className="eps-app__logo-title-wrapper e-onboarding__header-logo"> |
| 29 |
<i className="eps-app__logo eicon-elementor" /> |
| 30 |
<img |
| 31 |
src={ elementorCommon.config.urls.assets + 'images/logo-platform.svg' } |
| 32 |
alt={ __( 'Elementor Logo', 'elementor' ) } |
| 33 |
/> |
| 34 |
</div> |
| 35 |
<HeaderButtons buttons={ props.buttons } onClose={ onClose } /> |
| 36 |
{ ! state.hasPro && <GoProPopover buttonsConfig={ props.buttons } /> } |
| 37 |
</Grid> |
| 38 |
); |
| 39 |
} |
| 40 |
|
| 41 |
Header.propTypes = { |
| 42 |
title: PropTypes.string, |
| 43 |
buttons: PropTypes.arrayOf( PropTypes.object ), |
| 44 |
}; |
| 45 |
|
| 46 |
Header.defaultProps = { |
| 47 |
buttons: [], |
| 48 |
}; |
| 49 |
|