-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathsetup-top-bar.js
38 lines (34 loc) · 1.11 KB
/
setup-top-bar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* External dependencies
*/
import { getNewPath } from '@woocommerce/navigation';
import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import TopBar from '~/components/stepper/top-bar';
import HelpIconButton from '~/components/help-icon-button';
import { recordGlaEvent } from '~/utils/tracks';
/**
* @fires gla_setup_ads with given `{ triggered_by: 'back-button', action: 'leave' }` when back button is clicked.
*/
const SetupTopBar = () => {
// We record the intent to go back or to help - clicking buttons.
// Those events are fired before the actual navigation happens.
// The navigation itself may or maynot be blocked, for example to avoid leaving unsaved chanes.
const handleBackButtonClick = () => {
recordGlaEvent( 'gla_setup_ads', {
triggered_by: 'back-button',
action: 'leave',
} );
};
return (
<TopBar
title={ __( 'Set up your campaign', 'google-listings-and-ads' ) }
helpButton={ <HelpIconButton eventContext="setup-ads" /> }
backHref={ getNewPath( {}, '/google/dashboard' ) }
onBackButtonClick={ handleBackButtonClick }
/>
);
};
export default SetupTopBar;