Fix mobile app modal UI (#52201)

* Fix mobile app modal UI

* Add changelog

* Fix mobile style
This commit is contained in:
Chi-Hsuan Huang 2024-10-23 08:38:33 +08:00 committed by GitHub
parent 6e0c754f64
commit a71c52789f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 76 additions and 11 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix mobile app modal UI

View File

@ -115,16 +115,10 @@ export const MobileAppModal = () => {
state, state,
isRetryingMagicLinkSend, isRetryingMagicLinkSend,
magicLinkRequestStatus, magicLinkRequestStatus,
completeAppInstallationStep,
] ); ] );
return ( const clearQueryString = useCallback( () => {
<>
{ guideIsOpen && (
<Guide
onFinish={ () => {
updateOptions( {
woocommerce_admin_dismissed_mobile_app_modal: 'yes',
} );
// clear the search params that we use so that the URL is clean // clear the search params that we use so that the URL is clean
updateQueryString( updateQueryString(
{ {
@ -134,12 +128,29 @@ export const MobileAppModal = () => {
undefined, undefined,
Object.fromEntries( searchParams.entries() ) Object.fromEntries( searchParams.entries() )
); );
}, [ searchParams ] );
return (
<>
{ guideIsOpen && (
<Guide
onFinish={ () => {
updateOptions( {
woocommerce_admin_dismissed_mobile_app_modal: 'yes',
} );
clearQueryString();
} } } }
className={ 'woocommerce__mobile-app-welcome-modal' } className={ 'woocommerce__mobile-app-welcome-modal' }
pages={ [ pages={ [
{ {
content: ( content: (
<ModalIllustrationLayout body={ pageContent } /> <ModalIllustrationLayout
body={ pageContent }
onDismiss={ () => {
clearQueryString();
setGuideIsOpen( false );
} }
/>
), ),
}, },
] } ] }

View File

@ -2,6 +2,8 @@
* External dependencies * External dependencies
*/ */
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
import { Button, Icon } from '@wordpress/components';
import { closeSmall } from '@wordpress/icons';
/** /**
* Internal dependencies * Internal dependencies
@ -10,8 +12,10 @@ import Illustration from '../illustrations/intro-devices-desktop.png';
export const ModalIllustrationLayout = ( { export const ModalIllustrationLayout = ( {
body, body,
onDismiss,
}: { }: {
body: React.ReactNode; body: React.ReactNode;
onDismiss: () => void;
} ) => { } ) => {
return ( return (
<div className="mobile-app-modal-layout"> <div className="mobile-app-modal-layout">
@ -25,6 +29,15 @@ export const ModalIllustrationLayout = ( {
) } ) }
/> />
</div> </div>
<Button
variant="tertiary"
className="woocommerce__mobile-app-welcome-modal__close-button"
label={ __( 'Close', 'woocommerce' ) }
icon={ <Icon icon={ closeSmall } viewBox="6 4 12 14" /> }
iconSize={ 16 }
size={ 16 }
onClick={ onDismiss }
></Button>
</div> </div>
); );
}; };

View File

@ -16,6 +16,11 @@
// Overrides the default modal max-height. // Overrides the default modal max-height.
max-height: unset; max-height: unset;
@media only screen and (max-width: $break-mobile) {
min-width: 100%;
max-height: 100%;
}
.components-modal__header { .components-modal__header {
height: 0; height: 0;
@ -35,6 +40,10 @@
grid-template-columns: 3fr 2fr; grid-template-columns: 3fr 2fr;
min-height: 575px; min-height: 575px;
@media only screen and (max-width: $break-mobile) {
grid-template-columns: 1fr;
}
.mobile-app-modal-content { .mobile-app-modal-content {
display: flex; display: flex;
@ -47,10 +56,13 @@
.modal-layout-header { .modal-layout-header {
.modal-header > h1 { .modal-header > h1 {
line-height: normal; line-height: normal;
margin: 24px 0 0;
} }
} }
.modal-layout-body { .modal-layout-body {
flex-grow: 1; flex-grow: 1;
margin-bottom: 16px;
.modal-subheader { .modal-subheader {
margin-top: 16px; margin-top: 16px;
margin-bottom: 24px; margin-bottom: 24px;
@ -58,6 +70,7 @@
font-weight: 400; font-weight: 400;
color: #757575; color: #757575;
line-height: 1.6rem; line-height: 1.6rem;
margin: 0;
} }
} }
} }
@ -95,13 +108,17 @@
background-repeat: no-repeat; background-repeat: no-repeat;
background-image: url("data:image/svg+xml,%3Csvg width='341' height='421' viewBox='0 0 341 421' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M-258.536 396.856L-329.719 373.412C-338.484 370.525 -343.249 361.08 -340.362 352.315L-271.987 144.717C-269.1 135.952 -259.655 131.187 -250.89 134.074L-179.707 157.519C-69.5553 193.799 49.1512 133.914 85.431 23.7615L99.9575 -20.3434C102.844 -29.1081 112.29 -33.8731 121.054 -30.9864L328.652 37.3885C337.417 40.2752 342.182 49.7205 339.295 58.4852L324.769 102.59C244.953 344.925 -16.2016 476.672 -258.536 396.856Z' fill='%237F54B3'/%3E%3C/svg%3E"); background-image: url("data:image/svg+xml,%3Csvg width='341' height='421' viewBox='0 0 341 421' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M-258.536 396.856L-329.719 373.412C-338.484 370.525 -343.249 361.08 -340.362 352.315L-271.987 144.717C-269.1 135.952 -259.655 131.187 -250.89 134.074L-179.707 157.519C-69.5553 193.799 49.1512 133.914 85.431 23.7615L99.9575 -20.3434C102.844 -29.1081 112.29 -33.8731 121.054 -30.9864L328.652 37.3885C337.417 40.2752 342.182 49.7205 339.295 58.4852L324.769 102.59C244.953 344.925 -16.2016 476.672 -258.536 396.856Z' fill='%237F54B3'/%3E%3C/svg%3E");
padding-top: 36px; padding-top: 74px;
overflow: clip; overflow: clip;
img { img {
margin-right: -24px; margin-right: -24px;
width: 100%; width: 100%;
} }
@media only screen and (max-width: $break-mobile) {
display: none;
}
} }
} }
} }
@ -113,6 +130,25 @@
.fill-theme-color { .fill-theme-color {
fill: var(--wp-admin-theme-color); fill: var(--wp-admin-theme-color);
} }
.components-button.woocommerce__mobile-app-welcome-modal__close-button {
width: 24px;
height: 24px;
min-width: 24px;
position: absolute;
right: 16px;
top: 16px;
margin: 0;
padding: 0;
svg {
fill: #fff;
@media only screen and (max-width: $break-mobile) {
fill: $gray-900;
}
}
}
} }
.woo-icon { .woo-icon {
height: 48px; height: 48px;
@ -280,3 +316,4 @@ button.components-button.send-magic-link-button {
} }
} }
} }