From a75d1a525468c5d4ed7425cf101e393ae1bf6e41 Mon Sep 17 00:00:00 2001 From: Bec Scott Date: Fri, 2 Oct 2020 11:47:08 +1000 Subject: [PATCH] Change store details tooltip to a popover (https://github.com/woocommerce/woocommerce-admin/pull/5212) * Change store details tooltip to a popover * Change 'skip setup' tooltip to be a popover as well Co-authored-by: Rebecca Scott --- .../index.js} | 98 ++++++++++++++----- .../steps/store-details/style.scss | 5 + 2 files changed, 79 insertions(+), 24 deletions(-) rename plugins/woocommerce-admin/client/profile-wizard/steps/{store-details.js => store-details/index.js} (81%) create mode 100644 plugins/woocommerce-admin/client/profile-wizard/steps/store-details/style.scss diff --git a/plugins/woocommerce-admin/client/profile-wizard/steps/store-details.js b/plugins/woocommerce-admin/client/profile-wizard/steps/store-details/index.js similarity index 81% rename from plugins/woocommerce-admin/client/profile-wizard/steps/store-details.js rename to plugins/woocommerce-admin/client/profile-wizard/steps/store-details/index.js index e13105456cd..c5f521db2cf 100644 --- a/plugins/woocommerce-admin/client/profile-wizard/steps/store-details.js +++ b/plugins/woocommerce-admin/client/profile-wizard/steps/store-details/index.js @@ -9,11 +9,10 @@ import { CardFooter, CheckboxControl, FlexItem, - Icon, - Tooltip, __experimentalText as Text, + Popover, } from '@wordpress/components'; -import { Component, Fragment } from '@wordpress/element'; +import { Component } from '@wordpress/element'; import { compose } from '@wordpress/compose'; import { withDispatch, withSelect } from '@wordpress/data'; import { Form } from '@woocommerce/components'; @@ -24,13 +23,14 @@ import { recordEvent } from '@woocommerce/tracks'; /** * Internal dependencies */ -import { getCountryCode, getCurrencyRegion } from '../../dashboard/utils'; +import { getCountryCode, getCurrencyRegion } from '../../../dashboard/utils'; import { StoreAddress, validateStoreAddress, -} from '../../dashboard/components/settings/general/store-address'; -import UsageModal from './usage-modal'; -import { CurrencyContext } from '../../lib/currency-context'; +} from '../../../dashboard/components/settings/general/store-address'; +import UsageModal from '../usage-modal'; +import { CurrencyContext } from '../../../lib/currency-context'; +import './style.scss'; class StoreDetails extends Component { constructor( props ) { @@ -40,6 +40,8 @@ class StoreDetails extends Component { this.state = { showUsageModal: false, skipping: false, + isStoreDetailsPopoverVisible: false, + isSkipSetupPopoverVisible: false, }; // Check if a store address is set so that we don't default @@ -164,7 +166,12 @@ class StoreDetails extends Component { } render() { - const { showUsageModal, skipping } = this.state; + const { + showUsageModal, + skipping, + isStoreDetailsPopoverVisible, + isSkipSetupPopoverVisible, + } = this.state; const { skipProfiler } = this.props; /* eslint-disable @wordpress/i18n-no-collapsible-whitespace */ @@ -180,7 +187,7 @@ class StoreDetails extends Component { /* eslint-enable @wordpress/i18n-no-collapsible-whitespace */ return ( - +
{ __( 'Welcome to WooCommerce', 'woocommerce-admin' ) } @@ -191,15 +198,39 @@ class StoreDetails extends Component { 'woocommerce-admin' ) } - - + this.setState( { + isStoreDetailsPopoverVisible: true, + } ) + } + > + + + { isStoreDetailsPopoverVisible && ( + + this.setState( { + isStoreDetailsPopoverVisible: false, + } ) + } + > + { configureCurrencyText } + + ) }
- - + this.setState( { isSkipSetupPopoverVisible: true } ) + } + > + + + { isSkipSetupPopoverVisible && ( + + this.setState( { + isSkipSetupPopoverVisible: false, + } ) + } + > + { skipSetupText } + + ) }
-
+ ); } } diff --git a/plugins/woocommerce-admin/client/profile-wizard/steps/store-details/style.scss b/plugins/woocommerce-admin/client/profile-wizard/steps/store-details/style.scss new file mode 100644 index 00000000000..19349603312 --- /dev/null +++ b/plugins/woocommerce-admin/client/profile-wizard/steps/store-details/style.scss @@ -0,0 +1,5 @@ +.woocommerce-profile-wizard__store-details { + .components-popover .components-popover__content { + min-width: 360px; + } +}