2020-12-16 14:08:14 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
import { Component } from '@wordpress/element';
|
|
|
|
import { Button, Modal } from '@wordpress/components';
|
|
|
|
|
|
|
|
export class NavigationOptOutContainer extends Component {
|
|
|
|
constructor( props ) {
|
|
|
|
super( props );
|
|
|
|
this.state = {
|
|
|
|
isModalOpen: true,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { isModalOpen } = this.state;
|
|
|
|
if ( ! isModalOpen ) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-01-15 14:54:26 +00:00
|
|
|
if ( ! window.surveyData || ! window.surveyData.url ) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-12-16 14:08:14 +00:00
|
|
|
return (
|
|
|
|
<Modal
|
|
|
|
title={ __( 'Help us improve', 'woocommerce-admin' ) }
|
|
|
|
onRequestClose={ () => this.setState( { isModalOpen: false } ) }
|
|
|
|
className="woocommerce-navigation-opt-out-modal"
|
|
|
|
>
|
|
|
|
<p>
|
|
|
|
{ __(
|
|
|
|
"Take this 2-minute survey to share why you're opting out of the new navigation",
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div className="woocommerce-navigation-opt-out-modal__actions">
|
|
|
|
<Button
|
|
|
|
isDefault
|
|
|
|
onClick={ () =>
|
|
|
|
this.setState( { isModalOpen: false } )
|
|
|
|
}
|
|
|
|
>
|
|
|
|
{ __( 'No thanks', 'woocommerce-admin' ) }
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
isPrimary
|
|
|
|
target="_blank"
|
2021-01-15 14:54:26 +00:00
|
|
|
href={ window.surveyData.url }
|
2020-12-16 14:08:14 +00:00
|
|
|
onClick={ () =>
|
|
|
|
this.setState( { isModalOpen: false } )
|
|
|
|
}
|
|
|
|
>
|
|
|
|
{ __( 'Share feedback', 'woocommerce-admin' ) }
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|