Remove retry button when offline in CYS (#40694)

* Remove retry button and update copy when internet is not available in intro page

* Changelog

* Update test
This commit is contained in:
Ilyas Foo 2023-10-12 10:49:25 +08:00 committed by GitHub
parent ff51b07da3
commit 4bc7964b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 15 deletions

View File

@ -23,9 +23,9 @@ export const BaseIntroBanner = ( {
bannerTitle: string;
bannerText: string;
bannerClass: string;
buttonIsLink: boolean;
bannerButtonOnClick: () => void;
bannerButtonText: string;
buttonIsLink?: boolean;
bannerButtonOnClick?: () => void;
bannerButtonText?: string;
children?: React.ReactNode;
} ) => {
return (
@ -38,12 +38,16 @@ export const BaseIntroBanner = ( {
<div className={ `woocommerce-customize-store-banner-content` }>
<h1>{ bannerTitle }</h1>
<p>{ bannerText }</p>
<Button
onClick={ () => bannerButtonOnClick() }
variant={ buttonIsLink ? 'link' : 'primary' }
>
{ bannerButtonText }
</Button>
{ bannerButtonText ? (
<Button
onClick={ () =>
bannerButtonOnClick && bannerButtonOnClick()
}
variant={ buttonIsLink ? 'link' : 'primary' }
>
{ bannerButtonText }
</Button>
) : null }
{ children }
</div>
</div>
@ -58,13 +62,11 @@ export const NetworkOfflineBanner = () => {
'woocommerce'
) }
bannerText={ __(
"Unfortunately, the [AI Store designer] isn't available right now as we can't detect your network. Please check your internet connection and try again.",
"Unfortunately, the [AI Store designer] isn't available right now as we can't detect your network. Please check your internet connection.",
'woocommerce'
) }
bannerClass="offline-banner"
buttonIsLink={ false }
bannerButtonOnClick={ () => {} }
bannerButtonText={ __( 'Retry', 'woocommerce' ) }
/>
);
};

View File

@ -48,9 +48,7 @@ describe( 'Intro Banners', () => {
);
expect(
screen.getByText(
/Please check your internet connection and try again./i
)
screen.getByText( /Please check your internet connection./i )
).toBeInTheDocument();
} );

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Remove retry button and update copy when CYS intro page is working offline