-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2660 from woocommerce/update/2605-edit-accounts
Consolidate accounts onboarding: Add edit mode to the combo card to enable it to disconnect accounts
- Loading branch information
Showing
19 changed files
with
564 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
js/src/components/google-account-card/switch-account-button.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import AppButton from '.~/components/app-button'; | ||
import useSwitchGoogleAccount from './useSwitchGoogleAccount'; | ||
|
||
/** | ||
* Clicking on the "connect to a different Google account" button. | ||
* | ||
* @event gla_google_account_connect_different_account_button_click | ||
*/ | ||
|
||
/** | ||
* Renders a switch button that lets user connect with another Google account. | ||
* | ||
* @fires gla_google_account_connect_different_account_button_click | ||
* @param {Object} props React props | ||
* @param {string} [props.text="Or, connect to a different Google account"] Text to display on the button | ||
*/ | ||
const SwitchAccountButton = ( { | ||
text = __( | ||
'Or, connect to a different Google account', | ||
'google-listings-and-ads' | ||
), | ||
...restProps | ||
} ) => { | ||
const [ handleSwitch, { loading } ] = useSwitchGoogleAccount(); | ||
|
||
return ( | ||
<AppButton | ||
isLink | ||
disabled={ loading } | ||
text={ text } | ||
eventName="gla_google_account_connect_different_account_button_click" | ||
onClick={ handleSwitch } | ||
{ ...restProps } | ||
/> | ||
); | ||
}; | ||
|
||
export default SwitchAccountButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.