diff --git a/projects/plugins/jetpack/changelog/update-email-preview-styles b/projects/plugins/jetpack/changelog/update-email-preview-styles new file mode 100644 index 0000000000000..f0791d44441e4 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-email-preview-styles @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +feature flag feature, not yet released diff --git a/projects/plugins/jetpack/extensions/blocks/subscriptions/email-preview.js b/projects/plugins/jetpack/extensions/blocks/subscriptions/email-preview.js index 55139b89d5daf..34313510ad5f2 100644 --- a/projects/plugins/jetpack/extensions/blocks/subscriptions/email-preview.js +++ b/projects/plugins/jetpack/extensions/blocks/subscriptions/email-preview.js @@ -20,7 +20,7 @@ import { useSelect, useDispatch } from '@wordpress/data'; import { store as editorStore } from '@wordpress/editor'; import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; -import { desktop, mobile, tablet, check } from '@wordpress/icons'; +import { desktop, mobile, tablet, check, people, currencyDollar } from '@wordpress/icons'; import './email-preview.scss'; import { useCallback, useEffect } from 'react'; import { accessOptions } from '../../shared/memberships/constants'; @@ -123,39 +123,79 @@ export default function EmailPreview( { isModalOpen, closeModal } ) { } const devices = [ - { name: 'desktop', icon: desktop, label: __( 'Desktop', 'jetpack' ), width: '100%' }, - { name: 'tablet', icon: tablet, label: __( 'Tablet', 'jetpack' ), width: '768px' }, - { name: 'mobile', icon: mobile, label: __( 'Mobile', 'jetpack' ), width: '360px' }, + { + name: 'desktop', + icon: desktop, + label: __( 'Desktop', 'jetpack' ), + width: '100%', + size: 'lg', + }, + { + name: 'tablet', + icon: tablet, + label: __( 'Tablet', 'jetpack' ), + width: '768px', + size: 'md', + }, + { + name: 'mobile', + icon: mobile, + label: __( 'Mobile', 'jetpack' ), + width: '360px', + size: 'sm', + }, ]; -const DevicePicker = ( { selectedDevice, setSelectedDevice } ) => ( - - { devices.map( device => ( - - ) ) } - -); +const DevicePicker = ( { selectedDevice, setSelectedDevice } ) => { + const [ isMedium ] = useBreakpointMatch( 'md' ); + const [ isSmall ] = useBreakpointMatch( 'sm' ); + + if ( isSmall ) { + return null; + } + + const getAvailableDevices = () => { + if ( isMedium ) { + return devices.filter( device => device.size !== 'lg' ); + } + return devices; + }; + + return ( + + { getAvailableDevices().map( device => ( + + ) ) } + + ); +}; const AccessPicker = ( { selectedAccess, setSelectedAccess } ) => { + const [ isSmall ] = useBreakpointMatch( 'sm' ); + const accessOptionsList = [ { - label: __( 'Subscribers', 'jetpack' ), + label: accessOptions.subscribers.label, value: accessOptions.subscribers.key, + icon: people, }, { - label: __( 'Paid Subscribers', 'jetpack' ), + label: accessOptions.paid_subscribers.label, value: accessOptions.paid_subscribers.key, + icon: currencyDollar, }, ]; + return ( { isBlock isAdaptiveWidth > - { accessOptionsList.map( access => ( - - ) ) } + { accessOptionsList.map( access => + isSmall ? ( + + ) : ( + + ) + ) } ); }; @@ -177,8 +230,10 @@ const HeaderActions = ( { selectedDevice, setSelectedDevice, } ) => { + const [ isSmall ] = useBreakpointMatch( 'sm' ); + return ( - + @@ -255,14 +310,14 @@ export function PreviewModal( { isOpen, onClose, postId } ) { setSelectedDevice={ setSelectedDevice } /> } - overlayClassName="jetpack-preview-email-modal-overlay" + className="jetpack-email-preview-modal" >
{ isLoading ? ( @@ -273,6 +328,7 @@ export function PreviewModal( { isOpen, onClose, postId } ) { style={ { width: deviceWidth, height: '100%', + border: 'none', } } title={ __( 'Email Preview', 'jetpack' ) } /> diff --git a/projects/plugins/jetpack/extensions/blocks/subscriptions/email-preview.scss b/projects/plugins/jetpack/extensions/blocks/subscriptions/email-preview.scss index 5f8fcb177fdb8..8e29125ac6984 100644 --- a/projects/plugins/jetpack/extensions/blocks/subscriptions/email-preview.scss +++ b/projects/plugins/jetpack/extensions/blocks/subscriptions/email-preview.scss @@ -61,8 +61,8 @@ align-items: center; } -.jetpack-preview-email-modal-overlay { - .jetpack-email-preview-select-control .components-input-control__prefix { - margin-left: 18px; +.jetpack-email-preview-modal { + h1 { + flex-shrink: 0; } } \ No newline at end of file